diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-07-14 17:48:25 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-07-14 17:48:25 (GMT) |
commit | b6ffa7980f2f0fe27efa6cd0e80e511f6bfb00e0 (patch) | |
tree | 65c9ef14c7681aee96effe95061472df1a82ef4f /Lib/unittest | |
parent | 31f4beb15e959e818947db3297ac639bc2afc067 (diff) | |
download | cpython-b6ffa7980f2f0fe27efa6cd0e80e511f6bfb00e0.zip cpython-b6ffa7980f2f0fe27efa6cd0e80e511f6bfb00e0.tar.gz cpython-b6ffa7980f2f0fe27efa6cd0e80e511f6bfb00e0.tar.bz2 |
test that TestCase doesn't get cycles
Diffstat (limited to 'Lib/unittest')
-rw-r--r-- | Lib/unittest/test/test_case.py | 9 |
1 files changed, 9 insertions, 0 deletions
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()) |