diff options
author | Guido van Rossum <guido@python.org> | 2014-05-13 16:19:39 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2014-05-13 16:19:39 (GMT) |
commit | 7664eb02973cad889e96c2aec7226dc890983d45 (patch) | |
tree | b59189b301ad867434b258f26ae9576677260bd8 /Lib/test/test_asyncio/test_streams.py | |
parent | 15bec9cb3f317aa9e637735e5ea6061bd0e145c2 (diff) | |
download | cpython-7664eb02973cad889e96c2aec7226dc890983d45.zip cpython-7664eb02973cad889e96c2aec7226dc890983d45.tar.gz cpython-7664eb02973cad889e96c2aec7226dc890983d45.tar.bz2 |
Fix test-order-dependend asyncio test failure caused by rev 909ea8cc86bbab92dbb6231668f403b7360f30fa.
Diffstat (limited to 'Lib/test/test_asyncio/test_streams.py')
-rw-r--r-- | 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 index 23012b7..1ecc8eb 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -593,9 +593,6 @@ class StreamReaderTests(unittest.TestCase): # 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 @@ os.close(fd) 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)) |