summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-06-05 12:15:29 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-06-05 12:15:29 (GMT)
commit9844993cde5d8572d8e611d8b437a2e45e841414 (patch)
treecb9ec5175077156a102fcbfba407d1b91b424d28 /Lib/test
parentf86a5e8a93ab293d4cc00a8f2835d6d2cd3baa69 (diff)
downloadcpython-9844993cde5d8572d8e611d8b437a2e45e841414.zip
cpython-9844993cde5d8572d8e611d8b437a2e45e841414.tar.gz
cpython-9844993cde5d8572d8e611d8b437a2e45e841414.tar.bz2
Add test for multiprocessing.Conditon.wait() and changset 3baeb5e13dd2
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_multiprocessing.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index f02041e..78cbdac 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -956,6 +956,34 @@ class _TestCondition(BaseTestCase):
p.join(5)
self.assertTrue(success.value)
+ @classmethod
+ def _test_wait_result(cls, c, pid):
+ with c:
+ c.notify()
+ time.sleep(1)
+ if pid is not None:
+ os.kill(pid, signal.SIGINT)
+
+ def test_wait_result(self):
+ if isinstance(self, ProcessesMixin) and sys.platform != 'win32':
+ pid = os.getpid()
+ else:
+ pid = None
+
+ c = self.Condition()
+ with c:
+ self.assertFalse(c.wait(0))
+ self.assertFalse(c.wait(0.1))
+
+ p = self.Process(target=self._test_wait_result, args=(c, pid))
+ p.start()
+
+ self.assertTrue(c.wait(10))
+ if pid is not None:
+ self.assertRaises(KeyboardInterrupt, c.wait, 10)
+
+ p.join()
+
class _TestEvent(BaseTestCase):