Skip to content

Commit b6377fa

Browse files
authored
Fix PyPy coroutines testing to exclude uvloop (#601)
* Fix PyPy coroutines testing to exclude uvloop * [Mega-Linter] Apply linters fixes * Bump Tests Co-authored-by: TimPansino <[email protected]>
1 parent 91fecbf commit b6377fa

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tests/coroutines_asyncio/test_context_propagation.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import sys
1616

1717
import pytest
18-
import uvloop
1918
from testing_support.fixtures import (
2019
function_not_called,
2120
override_generic_settings,
@@ -34,6 +33,14 @@
3433
from newrelic.core.config import global_settings
3534
from newrelic.core.trace_cache import trace_cache
3635

36+
# uvloop is not available on PyPy.
37+
try:
38+
import uvloop
39+
40+
loop_policies = (None, uvloop.EventLoopPolicy())
41+
except ImportError:
42+
loop_policies = (None,)
43+
3744

3845
@function_trace("waiter3")
3946
async def child():
@@ -88,7 +95,7 @@ async def _test(asyncio, schedule, nr_enabled=True):
8895
return trace
8996

9097

91-
@pytest.mark.parametrize("loop_policy", (None, uvloop.EventLoopPolicy()))
98+
@pytest.mark.parametrize("loop_policy", loop_policies)
9299
@pytest.mark.parametrize(
93100
"schedule",
94101
(

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ envlist =
6464
python-component_graphqlserver-{py36,py37,py38,py39,py310},
6565
python-component_tastypie-{py27,pypy}-tastypie0143,
6666
python-component_tastypie-{py36,py37,py38,py39,pypy36}-tastypie{0143,latest},
67-
python-coroutines_asyncio-{py36,py37,py38,py39,py310,pypy36},
67+
python-coroutines_asyncio-{py36,py37,py38,py39,py310,pypy37},
6868
python-cross_agent-{py27,py36,py37,py38,py39,py310}-{with,without}_extensions,
6969
python-cross_agent-pypy-without_extensions,
7070
postgres-datastore_asyncpg-{py36,py37,py38,py39,py310},
@@ -200,7 +200,7 @@ deps =
200200
component_tastypie-{py36,py37,py38,py39,py310,pypy36,pypy37}-tastypie0143: django<3.0.1
201201
component_tastypie-tastypielatest: django-tastypie
202202
component_tastypie-tastypielatest: django<4.1
203-
coroutines_asyncio: uvloop
203+
coroutines_asyncio-{py36,py37,py38,py39,py310}: uvloop
204204
cross_agent: mock==1.0.1
205205
cross_agent: requests
206206
datastore_asyncpg: asyncpg

0 commit comments

Comments
 (0)