]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test that TestCase doesn't get cycles
authorBenjamin Peterson <benjamin@python.org>
Thu, 14 Jul 2011 17:48:25 +0000 (12:48 -0500)
committerBenjamin Peterson <benjamin@python.org>
Thu, 14 Jul 2011 17:48:25 +0000 (12:48 -0500)
Lib/unittest/test/test_case.py

index 147a4da3a3038aa2ff6e19eb1fe9c4494c1678d2..fdb2e78462ee0724fe5ed2c54c27d8ed431c1a9e 100644 (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())