summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-06 01:21:57 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-06 01:21:57 +0100
commit9f1e74d269679452f2a7d6278fe433c92cea17cc (patch)
treeedbe0d3d04d1a5b555e2105d6b50c5133fb8bfd3 /tests
parent9b36966cb84f883d190e16330326ee5049a595c2 (diff)
downloadtrollius-git-9f1e74d269679452f2a7d6278fe433c92cea17cc.tar.gz
Python issue #23140: Simplify the unit test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_subprocess.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py
index dfe23be..1fe9095 100644
--- a/tests/test_subprocess.py
+++ b/tests/test_subprocess.py
@@ -227,20 +227,18 @@ class SubprocessMixin:
# Issue #23140: cancel Process.wait()
@asyncio.coroutine
- def wait_proc(proc, event):
- event.set()
- yield from proc.wait()
-
- @asyncio.coroutine
def cancel_wait():
proc = yield from asyncio.create_subprocess_exec(
*PROGRAM_BLOCKED,
loop=self.loop)
# Create an internal future waiting on the process exit
- event = asyncio.Event(loop=self.loop)
- task = self.loop.create_task(wait_proc(proc, event))
- yield from event.wait()
+ task = self.loop.create_task(proc.wait())
+ self.loop.call_soon(task.cancel)
+ try:
+ yield from task
+ except asyncio.CancelledError:
+ pass
# Cancel the future
task.cancel()