diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-10-12 23:52:21 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-10-12 23:52:21 (GMT) |
commit | 7b4a36194af5942d3a497cecc1cc0cae8f3e00fd (patch) | |
tree | e09de52b9a503657587c2e852bd13d31950888b5 /Lib/test | |
parent | 84fc7081f55f517062b35d0e0628cdfa4f1b9d55 (diff) | |
parent | 4f35079858695e4d74a82a304332f70a0aa98e92 (diff) | |
download | cpython-7b4a36194af5942d3a497cecc1cc0cae8f3e00fd.zip cpython-7b4a36194af5942d3a497cecc1cc0cae8f3e00fd.tar.gz cpython-7b4a36194af5942d3a497cecc1cc0cae8f3e00fd.tar.bz2 |
Merge.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index de0c968..0324afa 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -273,7 +273,7 @@ class _TestProcess(BaseTestCase): @classmethod def _test_terminate(cls): - time.sleep(1000) + time.sleep(100) def test_terminate(self): if self.TYPE == 'threads': @@ -299,7 +299,19 @@ class _TestProcess(BaseTestCase): p.terminate() - self.assertEqual(join(), None) + if hasattr(signal, 'alarm'): + def handler(*args): + raise RuntimeError('join took too long: pid=%s' % p.pid) + old_handler = signal.signal(signal.SIGALRM, handler) + try: + signal.alarm(10) + self.assertEqual(join(), None) + signal.alarm(0) + finally: + signal.signal(signal.SIGALRM, old_handler) + else: + self.assertEqual(join(), None) + self.assertTimingAlmostEqual(join.elapsed, 0.0) self.assertEqual(p.is_alive(), False) |