Skip to content

Commit b224f86

Browse files
committed
3.5 compat.
1 parent b76a835 commit b224f86

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pytest_asyncio/plugin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ def _is_coroutine(obj):
1515
return asyncio.iscoroutinefunction(obj) or inspect.isgeneratorfunction(obj)
1616

1717

18+
if sys.version_info[:2] < (3, 6):
19+
def isasyncgenfunction(_):
20+
return False
21+
else:
22+
from inspect import isasyncgenfunction
23+
24+
1825
def pytest_configure(config):
1926
"""Inject documentation."""
2027
config.addinivalue_line("markers",
@@ -48,7 +55,7 @@ def pytest_pycollect_makeitem(collector, name, obj):
4855
@pytest.hookimpl(hookwrapper=True)
4956
def pytest_fixture_setup(fixturedef, request):
5057
"""Adjust the event loop policy when an event loop is produced."""
51-
if inspect.isasyncgenfunction(fixturedef.func):
58+
if isasyncgenfunction(fixturedef.func):
5259
# This is an async generator function. Wrap it accordingly.
5360
f = fixturedef.func
5461

0 commit comments

Comments
 (0)