MCPcopy Index your code
hub / github.com/python/cpython / test_gc_main_module_at_shutdown

Method test_gc_main_module_at_shutdown

Lib/test/test_gc.py:772–783  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

770 self.assertNotIn(b"uncollectable objects at shutdown", stderr)
771
772 def test_gc_main_module_at_shutdown(self):
773 # Create a reference cycle through the __main__ module and check
774 # it gets collected at interpreter shutdown.
775 code = """if 1:
776 class C:
777 def __del__(self):
778 print('__del__ called')
779 l = [C()]
780 l.append(l)
781 """
782 rc, out, err = assert_python_ok('-c', code)
783 self.assertEqual(out.strip(), b'__del__ called')
784
785 def test_gc_ordinary_module_at_shutdown(self):
786 # Same as above, but with a non-__main__ module.

Callers

nothing calls this directly

Calls 3

assert_python_okFunction · 0.90
assertEqualMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected