Skip to content

Commit a0dfd8b

Browse files
committed
Do not stop threaded loop adapter for each test method
1 parent 11f47f5 commit a0dfd8b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ def allow_windows(test_method):
2626

2727
@wraps(test_method)
2828
async def wrapped(self, *args, **kwargs):
29-
caller_id = 1234
30-
_ThreadedLoopAdapter.start(caller_id)
29+
_ThreadedLoopAdapter.start(id(test_method))
3130
coro = test_method(self, *args, **kwargs)
32-
asyncio.run_coroutine_threadsafe(coro=coro, loop=_ThreadedLoopAdapter._loop).result()
33-
_ThreadedLoopAdapter.stop(caller_id)
31+
future = asyncio.run_coroutine_threadsafe(coro=coro, loop=_ThreadedLoopAdapter._loop)
32+
return future.result()
3433

3534
return wrapped
3635

0 commit comments

Comments
 (0)