From b6ffa7980f2f0fe27efa6cd0e80e511f6bfb00e0 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 14 Jul 2011 12:48:25 -0500 Subject: test that TestCase doesn't get cycles --- Lib/unittest/test/test_case.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py index 147a4da..fdb2e78 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()) -- cgit v0.12