if ns.slaveargs is not None:
args, kwargs = json.loads(ns.slaveargs)
+ if kwargs.get('huntrleaks'):
+ unittest.BaseTestSuite._cleanup = False
try:
result = runtest(*args, **kwargs)
except KeyboardInterrupt:
#gc.set_debug(gc.DEBUG_SAVEALL)
found_garbage = []
+ if ns.huntrleaks:
+ unittest.BaseTestSuite._cleanup = False
+
if ns.single:
filename = os.path.join(TEMPDIR, 'pynexttest')
try:
class BaseTestSuite(object):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
+ _cleanup = True
+
def __init__(self, tests=()):
self._tests = []
self.addTests(tests)
if result.shouldStop:
break
test(result)
- self._removeTestAtIndex(index)
+ if self._cleanup:
+ self._removeTestAtIndex(index)
return result
def _removeTestAtIndex(self, index):
else:
test.debug()
- self._removeTestAtIndex(index)
+ if self._cleanup:
+ self._removeTestAtIndex(index)
if topLevel:
self._tearDownPreviousClass(None, result)
suite.run(unittest.TestResult())
def test_remove_test_at_index(self):
+ if not unittest.BaseTestSuite._cleanup:
+ raise unittest.SkipTest("Suite cleanup is disabled")
+
suite = unittest.TestSuite()
suite._tests = [1, 2, 3]
self.assertEqual([1, None, 3], suite._tests)
def test_remove_test_at_index_not_indexable(self):
+ if not unittest.BaseTestSuite._cleanup:
+ raise unittest.SkipTest("Suite cleanup is disabled")
+
suite = unittest.TestSuite()
suite._tests = None
suite._removeTestAtIndex(2)
def assert_garbage_collect_test_after_run(self, TestSuiteClass):
+ if not unittest.BaseTestSuite._cleanup:
+ raise unittest.SkipTest("Suite cleanup is disabled")
class Foo(unittest.TestCase):
def test_nothing(self):