MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_gc_main_module_at_shutdown

Method test_gc_main_module_at_shutdown

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

Source from the content-addressed store, hash-verified

774 self.assertNotIn(b"uncollectable objects at shutdown", stderr)
775
776 def test_gc_main_module_at_shutdown(self):
777 # Create a reference cycle through the __main__ module and check
778 # it gets collected at interpreter shutdown.
779 code = """if 1:
780 class C:
781 def __del__(self):
782 print('__del__ called')
783 l = [C()]
784 l.append(l)
785 """
786 rc, out, err = assert_python_ok('-c', code)
787 self.assertEqual(out.strip(), b'__del__ called')
788
789 def test_gc_ordinary_module_at_shutdown(self):
790 # 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