summaryrefslogtreecommitdiffstats
path: root/Lib/test/fork_wait.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-05-09 19:17:02 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-05-09 19:17:02 (GMT)
commit606c3f548683a2fc8b7e53aeaafc279bb584eebf (patch)
treef9719378448a152ae4945fdbce23e576f79797dd /Lib/test/fork_wait.py
parent5aa878c61a7ecf043ac390672b997adbe7e340d0 (diff)
downloadcpython-606c3f548683a2fc8b7e53aeaafc279bb584eebf.zip
cpython-606c3f548683a2fc8b7e53aeaafc279bb584eebf.tar.gz
cpython-606c3f548683a2fc8b7e53aeaafc279bb584eebf.tar.bz2
Issue #12041: Make test_wait3 more robust.
Diffstat (limited to 'Lib/test/fork_wait.py')
-rw-r--r--Lib/test/fork_wait.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py
index 1caab1c..88527df 100644
--- a/Lib/test/fork_wait.py
+++ b/Lib/test/fork_wait.py
@@ -43,6 +43,7 @@ class ForkWait(unittest.TestCase):
self.assertEqual(spid, cpid)
self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
+ @support.reap_threads
def test_wait(self):
for i in range(NUM_THREADS):
_thread.start_new(self.f, (i,))
@@ -69,7 +70,8 @@ class ForkWait(unittest.TestCase):
os._exit(n)
else:
# Parent
- self.wait_impl(cpid)
- # Tell threads to die
- self.stop = 1
- time.sleep(2*SHORTSLEEP) # Wait for threads to die
+ try:
+ self.wait_impl(cpid)
+ finally:
+ # Tell threads to die
+ self.stop = 1