tests: set event_loop fixture to be session scoped

fixes https://github.com/lilydjwg/nvchecker/issues/129.
This commit is contained in:
lilydjwg 2020-07-02 00:45:55 +08:00
parent e176078226
commit 36c995eef6

View File

@ -54,10 +54,12 @@ async def get_version():
return __call__
@pytest.fixture(scope="module")
@pytest.fixture(scope="session")
def event_loop(request):
"""Override pytest-asyncio's event_loop fixture,
Don't create an instance of the default event loop for each test case.
The scope is session because the Tornado AsyncHTTPClient singleton remains.
"""
loop = asyncio.get_event_loop()
yield loop