File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,18 @@ def pytest_configure(config):
88 # https://twistedmatrix.com/trac/ticket/9766
99 # https://github.com/pytest-dev/pytest-twisted/issues/80
1010
11- if config .getoption ("reactor" , "default" ) == "asyncio" and platform .system () == "Windows" :
12- import asyncio
11+ import asyncio
1312
13+ if config .getoption ("reactor" , "default" ) == "asyncio" and platform .system () == "Windows" :
1414 selector_policy = asyncio .WindowsSelectorEventLoopPolicy ()
1515 asyncio .set_event_loop_policy (selector_policy )
1616
17+ # Ensure there's a running event loop for the tests
18+ try :
19+ asyncio .get_running_loop ()
20+ except RuntimeError :
21+ asyncio .set_event_loop (asyncio .new_event_loop ())
22+
1723
1824def pytest_sessionstart (session ): # pylint: disable=unused-argument
1925 """
You can’t perform that action at this time.
0 commit comments