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