MCPcopy
hub / github.com/django/django / __getstate__

Method __getstate__

django/test/testcases.py:316–331  ·  view source on GitHub ↗

Make SimpleTestCase picklable for parallel tests using subtests.

(self)

Source from the content-addressed store, hash-verified

314 self._setup_and_call(result)
315
316 def __getstate__(self):
317 """
318 Make SimpleTestCase picklable for parallel tests using subtests.
319 """
320 state = super().__dict__
321 # _outcome and _subtest cannot be tested on picklability, since they
322 # contain the TestCase itself, leading to an infinite recursion.
323 if state["_outcome"]:
324 pickable_state = {"_outcome": None, "_subtest": None}
325 for key, value in state.items():
326 if key in pickable_state or not is_pickable(value):
327 continue
328 pickable_state[key] = value
329 return pickable_state
330
331 return state
332
333 def debug(self):
334 """Perform the same as __call__(), without catching the exception."""

Callers

nothing calls this directly

Calls 2

is_pickableFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected