Kaydet (Commit) b6ffa798 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

test that TestCase doesn't get cycles

üst 31f4beb1
...@@ -4,6 +4,7 @@ import pickle ...@@ -4,6 +4,7 @@ import pickle
import re import re
import sys import sys
import warnings import warnings
import weakref
import inspect import inspect
from copy import deepcopy from copy import deepcopy
...@@ -1304,3 +1305,11 @@ test case ...@@ -1304,3 +1305,11 @@ test case
klass('test_something').run(result) klass('test_something').run(result)
self.assertEqual(len(result.errors), 1) self.assertEqual(len(result.errors), 1)
self.assertEqual(result.testsRun, 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())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment