wholecell.tests.utils.test_memory_debug

Test the memory_debug utility.

Running it this way reveals the stdout messages about MemoryDebugNode IDs:

python -m wholecell.tests.utils.test_memory_debug

In any case, you should see GC messages like:

gc: uncollectable <MemoryDebugNode 0x110118050> gc: uncollectable <MemoryDebugNode 0x110118090> gc: uncollectable <MemoryDebugNode 0x110118110> gc: uncollectable <dict 0x1101124b0> gc: uncollectable <dict 0x110112a28>

# The test case is adapted from https://pymotw.com/2/gc/

Per https://docs.python.org/2/library/gc.html, “Objects that have __del__() methods and are part of a reference cycle cause the entire reference cycle to be uncollectable, including objects not necessarily in the cycle but reachable only from it. Python doesn’t collect such cycles automatically because, in general, it isn’t possible for Python to guess a safe order in which to run the __del__() methods.”

Per https://docs.python.org/3/library/gc.html, “Changed in version 3.4: Following PEP 442, objects with a __del__() method don’t end up in gc.garbage anymore.”

class wholecell.tests.utils.test_memory_debug.MemoryDebugNode(name)[source]

Bases: object

class wholecell.tests.utils.test_memory_debug.Test_memory_debug(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []