-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix subprocess handling when forbid_global_loop.
- Loading branch information
Tin Tvrtković
authored and
Tin Tvrtković
committed
Nov 26, 2016
1 parent
eef8e0b
commit 150e913
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
coverage==4.1 | ||
tox==2.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Tests for using subprocesses in tests.""" | ||
import sys | ||
import asyncio | ||
import asyncio.subprocess | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.asyncio(forbid_global_loop=False) | ||
@asyncio.coroutine | ||
def test_subprocess(event_loop): | ||
"""Starting a subprocess should be possible.""" | ||
proc = yield from asyncio.subprocess.create_subprocess_exec( | ||
sys.executable, '--version', stdout=asyncio.subprocess.PIPE, | ||
loop=event_loop) | ||
yield from proc.communicate() | ||
|
||
|
||
@pytest.mark.asyncio(forbid_global_loop=True) | ||
@asyncio.coroutine | ||
def test_subprocess_forbid(event_loop): | ||
"""Starting a subprocess should be possible.""" | ||
proc = yield from asyncio.subprocess.create_subprocess_exec( | ||
sys.executable, '--version', stdout=asyncio.subprocess.PIPE, | ||
loop=event_loop) | ||
yield from proc.communicate() |