Skip to content

Commit 238cced

Browse files
simonfagerholmTinche
authored andcommitted
Put event_loop first among the fixtures of asyncio tests, fixes #154.
1 parent e5e3dc7 commit 238cced

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pytest_asyncio/plugin.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ def inner(**kwargs):
154154

155155

156156
def pytest_runtest_setup(item):
157-
if 'asyncio' in item.keywords and 'event_loop' not in item.fixturenames:
157+
if 'asyncio' in item.keywords:
158158
# inject an event loop fixture for all async tests
159-
item.fixturenames.append('event_loop')
159+
if 'event_loop' in item.fixturenames:
160+
item.fixturenames.remove('event_loop')
161+
item.fixturenames.insert(0, 'event_loop')
160162
if item.get_closest_marker("asyncio") is not None \
161163
and not getattr(item.obj, 'hypothesis', False) \
162164
and getattr(item.obj, 'is_hypothesis_test', False):

0 commit comments

Comments
 (0)