diff --git a/nvchecker/source/tornado_httpclient.py b/nvchecker/source/tornado_httpclient.py index 6185e90..c8ce818 100644 --- a/nvchecker/source/tornado_httpclient.py +++ b/nvchecker/source/tornado_httpclient.py @@ -17,7 +17,6 @@ from .httpclient import DEFAULT_USER_AGENT __all__ = ['session', 'HTTPError', 'NetworkErrors'] -client = AsyncHTTPClient() HTTP2_AVAILABLE = None if pycurl else False def try_use_http2(curl): @@ -66,7 +65,7 @@ class ResponseManager: self.req = req async def __aenter__(self): - return await client.fetch(self.req) + return await AsyncHTTPClient().fetch(self.req) async def __aexit__(self, exc_type, exc, tb): pass diff --git a/tests/conftest.py b/tests/conftest.py index bc8ae02..bddf44a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -54,12 +54,10 @@ async def get_version(): return __call__ -@pytest.fixture(scope="session") +@pytest.fixture(scope="module") 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