(self)
| 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. |
nothing calls this directly
no test coverage detected