diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-27 20:02:23 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-27 20:02:23 (GMT) |
commit | bb0bb30acc1698a34573e4ebba46e1f53d61d35c (patch) | |
tree | d65666feeea6eaac8e9f89c1601b05c9a29ccd0b /Lib/test | |
parent | a763c06357bd080e9e0afc7f29a742d427f1ee05 (diff) | |
download | cpython-bb0bb30acc1698a34573e4ebba46e1f53d61d35c.zip cpython-bb0bb30acc1698a34573e4ebba46e1f53d61d35c.tar.gz cpython-bb0bb30acc1698a34573e4ebba46e1f53d61d35c.tar.bz2 |
Suppress transient refleaks in test_threading.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_threading.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 71a8844..656aee6 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -54,7 +54,16 @@ class TestThread(threading.Thread): print '%s is finished. %d tasks are running' % ( self.name, self.nrunning.get()) -class ThreadTests(unittest.TestCase): +class BaseTestCase(unittest.TestCase): + def setUp(self): + self._threads = test.test_support.threading_setup() + + def tearDown(self): + test.test_support.threading_cleanup(*self._threads) + test.test_support.reap_children() + + +class ThreadTests(BaseTestCase): # Create a bunch of threads, let each do some work, wait until all are # done. @@ -382,7 +391,7 @@ class ThreadTests(unittest.TestCase): sys.getrefcount(weak_raising_cyclic_object()))) -class ThreadJoinOnShutdown(unittest.TestCase): +class ThreadJoinOnShutdown(BaseTestCase): def _run_and_join(self, script): script = """if 1: @@ -465,7 +474,7 @@ class ThreadJoinOnShutdown(unittest.TestCase): self._run_and_join(script) -class ThreadingExceptionTests(unittest.TestCase): +class ThreadingExceptionTests(BaseTestCase): # A RuntimeError should be raised if Thread.start() is called # multiple times. def test_start_thread_again(self): |