test that TestCase doesn't get cycles

This commit is contained in:
Benjamin Peterson 2011-07-14 12:48:25 -05:00
parent 31f4beb15e
commit b6ffa7980f
1 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import pickle
import re
import sys
import warnings
import weakref
import inspect
from copy import deepcopy
@ -1304,3 +1305,11 @@ test case
klass('test_something').run(result)
self.assertEqual(len(result.errors), 1)
self.assertEqual(result.testsRun, 1)
@support.cpython_only
def testNoCycles(self):
case = unittest.TestCase()
wr = weakref.ref(case)
with support.disable_gc():
del case
self.assertFalse(wr())