[Python-checkins] r80057 - python/branches/py3k-issue4970/Lib/test/test_wait3.py

mark.dickinson python-checkins at python.org
Tue Apr 13 17:10:26 CEST 2010


Author: mark.dickinson
Date: Tue Apr 13 17:10:26 2010
New Revision: 80057

Log:
A stab in the dark:  perhaps the failed execv + starting a single thread is enough.

Modified:
   python/branches/py3k-issue4970/Lib/test/test_wait3.py

Modified: python/branches/py3k-issue4970/Lib/test/test_wait3.py
==============================================================================
--- python/branches/py3k-issue4970/Lib/test/test_wait3.py	(original)
+++ python/branches/py3k-issue4970/Lib/test/test_wait3.py	Tue Apr 13 17:10:26 2010
@@ -3,42 +3,14 @@
 
 import os
 import time
-import unittest
-from test.fork_wait import ForkWait
-from test.support import run_unittest, reap_children
+import _thread
 
 try:
     os.execv('/usr/bin/dorothyq', ['dorothyq'])
 except OSError:
     pass
 
-try:
-    os.fork
-except AttributeError:
-    raise unittest.SkipTest("os.fork not defined -- skipping test_wait3")
-
-try:
-    os.wait3
-except AttributeError:
-    raise unittest.SkipTest("os.wait3 not defined -- skipping test_wait3")
-
-class Wait3Test(ForkWait):
-    def wait_impl(self, cpid):
-        for i in range(10):
-            # wait3() shouldn't hang, but some of the buildbots seem to hang
-            # in the forking tests.  This is an attempt to fix the problem.
-            spid, status, rusage = os.wait3(os.WNOHANG)
-            if spid == cpid:
-                break
-            time.sleep(1.0)
-
-        self.assertEqual(spid, cpid)
-        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
-        self.assertTrue(rusage)
-
-def test_main():
-    run_unittest(Wait3Test)
-    reap_children()
+def f():
+    time.sleep(1.0)
 
-if __name__ == "__main__":
-    test_main()
+_thread.start_new(f, ())


More information about the Python-checkins mailing list