summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-10-27 20:02:23 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-10-27 20:02:23 (GMT)
commitbb0bb30acc1698a34573e4ebba46e1f53d61d35c (patch)
treed65666feeea6eaac8e9f89c1601b05c9a29ccd0b /Lib/test
parenta763c06357bd080e9e0afc7f29a742d427f1ee05 (diff)
downloadcpython-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.py15
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):