summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-16 08:24:27 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-16 08:24:27 (GMT)
commitb5cace898074731428b98ea6ec133e204ece4cd2 (patch)
treeaa8332e9a267e98a0352314d2eebe51dfdd1e350 /Lib/test/test_asyncio
parente82881cea7a0cab6145a2071b08665c8e9ec9d31 (diff)
downloadcpython-b5cace898074731428b98ea6ec133e204ece4cd2.zip
cpython-b5cace898074731428b98ea6ec133e204ece4cd2.tar.gz
cpython-b5cace898074731428b98ea6ec133e204ece4cd2.tar.bz2
Issue #21645, #21985: Remove debug code
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_streams.py50
1 files changed, 17 insertions, 33 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index ef4fe8a..8adc3b2 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -609,41 +609,25 @@ os.close(fd)
rfd, wfd = os.pipe()
args = [sys.executable, '-c', code, str(wfd)]
- # FIXME: Debug code for issue #21645
- import logging
- self.loop.set_debug(True)
- logger = logging.getLogger('asyncio')
- log_level = logger.level
+ pipe = open(rfd, 'rb', 0)
+ reader = asyncio.StreamReader(loop=self.loop, limit=1)
+ protocol = asyncio.StreamReaderProtocol(reader, loop=self.loop)
+ transport, _ = self.loop.run_until_complete(
+ self.loop.connect_read_pipe(lambda: protocol, pipe))
+
+ watcher = asyncio.SafeChildWatcher()
+ watcher.attach_loop(self.loop)
try:
- log_handler = logging.StreamHandler(sys.__stderr__)
- logger.addHandler(log_handler)
- logger.setLevel(logging.DEBUG)
- # FIXME: Debug code for issue #21645 ---
-
- pipe = open(rfd, 'rb', 0)
- reader = asyncio.StreamReader(loop=self.loop, limit=1)
- protocol = asyncio.StreamReaderProtocol(reader, loop=self.loop)
- transport, _ = self.loop.run_until_complete(
- self.loop.connect_read_pipe(lambda: protocol, pipe))
-
- 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))
- self.assertEqual(data, b'data')
+ 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:
- # FIXME: Debug code for issue #21645
- logger.removeHandler(log_handler)
- logger.setLevel(log_level)
- # FIXME: Debug code for issue #21645 ---
+ asyncio.set_child_watcher(None)
+
+ os.close(wfd)
+ data = self.loop.run_until_complete(reader.read(-1))
+ self.assertEqual(data, b'data')
if __name__ == '__main__':