[Python-checkins] cpython (3.4): Fix test-order-dependend asyncio test failure caused by rev

guido.van.rossum python-checkins at python.org
Tue May 13 18:21:42 CEST 2014


http://hg.python.org/cpython/rev/16d0bcce10de
changeset:   90687:16d0bcce10de
branch:      3.4
parent:      90685:20db5e9086d4
user:        Guido van Rossum <guido at python.org>
date:        Tue May 13 09:19:39 2014 -0700
summary:
  Fix test-order-dependend asyncio test failure caused by rev 909ea8cc86bbab92dbb6231668f403b7360f30fa.

files:
  Lib/test/test_asyncio/test_streams.py |  15 +++++++++------
  1 files changed, 9 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -593,9 +593,6 @@
         # of the data writter.  Also we must explicitly attach a child
         # watcher to the event loop.
 
-        watcher = asyncio.get_child_watcher()
-        watcher.attach_loop(self.loop)
-
         code = """\
 import os, sys
 fd = int(sys.argv[1])
@@ -611,9 +608,15 @@
         transport, _ = self.loop.run_until_complete(
             self.loop.connect_read_pipe(lambda: protocol, pipe))
 
-        proc = self.loop.run_until_complete(
-            asyncio.create_subprocess_exec(*args, pass_fds={wfd}, loop=self.loop))
-        self.loop.run_until_complete(proc.wait())
+        watcher = asyncio.SafeChildWatcher()
+        watcher.attach_loop(self.loop)
+        try:
+            asyncio.set_child_watcher(watcher)
+            proc = self.loop.run_until_complete(
+                asyncio.create_subprocess_exec(*args, pass_fds={wfd}, loop=self.loop))
+            self.loop.run_until_complete(proc.wait())
+        finally:
+            asyncio.set_child_watcher(None)
 
         os.close(wfd)
         data = self.loop.run_until_complete(reader.read(-1))

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list