From: Benjamin Peterson Date: Thu, 14 Jul 2011 17:48:25 +0000 (-0500) Subject: test that TestCase doesn't get cycles X-Git-Tag: v3.3.0a1~1907 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6ffa7980f2f0fe27efa6cd0e80e511f6bfb00e0;p=thirdparty%2FPython%2Fcpython.git test that TestCase doesn't get cycles --- diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py index 147a4da3a303..fdb2e78462ee 100644 --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -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())