mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix test-order-dependend asyncio test failure caused by rev 909ea8cc86bbab92dbb6231668f403b7360f30fa.
This commit is contained in:
parent
15bec9cb3f
commit
7664eb0297
1 changed files with 9 additions and 6 deletions
|
@ -593,9 +593,6 @@ class StreamReaderTests(unittest.TestCase):
|
||||||
# of the data writter. Also we must explicitly attach a child
|
# of the data writter. Also we must explicitly attach a child
|
||||||
# watcher to the event loop.
|
# watcher to the event loop.
|
||||||
|
|
||||||
watcher = asyncio.get_child_watcher()
|
|
||||||
watcher.attach_loop(self.loop)
|
|
||||||
|
|
||||||
code = """\
|
code = """\
|
||||||
import os, sys
|
import os, sys
|
||||||
fd = int(sys.argv[1])
|
fd = int(sys.argv[1])
|
||||||
|
@ -611,9 +608,15 @@ os.close(fd)
|
||||||
transport, _ = self.loop.run_until_complete(
|
transport, _ = self.loop.run_until_complete(
|
||||||
self.loop.connect_read_pipe(lambda: protocol, pipe))
|
self.loop.connect_read_pipe(lambda: protocol, pipe))
|
||||||
|
|
||||||
proc = self.loop.run_until_complete(
|
watcher = asyncio.SafeChildWatcher()
|
||||||
asyncio.create_subprocess_exec(*args, pass_fds={wfd}, loop=self.loop))
|
watcher.attach_loop(self.loop)
|
||||||
self.loop.run_until_complete(proc.wait())
|
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)
|
os.close(wfd)
|
||||||
data = self.loop.run_until_complete(reader.read(-1))
|
data = self.loop.run_until_complete(reader.read(-1))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue