Issue #19527: Fixed tests with defined COUNT_ALLOCS.

This commit is contained in:
Serhiy Storchaka 2016-07-03 22:27:26 +03:00
parent af65872da2
commit a793037d80
10 changed files with 26 additions and 6 deletions

View file

@ -1,7 +1,7 @@
# Test the module type
import unittest
import weakref
from test.support import gc_collect
from test.support import gc_collect, requires_type_collecting
from test.support.script_helper import assert_python_ok
import sys
@ -101,6 +101,7 @@ class ModuleTests(unittest.TestCase):
gc_collect()
self.assertEqual(f().__dict__["bar"], 4)
@requires_type_collecting
def test_clear_dict_in_ref_cycle(self):
destroyed = []
m = ModuleType("foo")
@ -214,6 +215,7 @@ a = A(destroyed)"""
self.assertEqual(r[-len(ends_with):], ends_with,
'{!r} does not end with {!r}'.format(r, ends_with))
@requires_type_collecting
def test_module_finalization_at_shutdown(self):
# Module globals and builtins should still be available during shutdown
rc, out, err = assert_python_ok("-c", "from test import final_a")