1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-26 16:58:28 +00:00

Fix changing to ProactorEventLoop in tests.

This commit is contained in:
grossmj 2020-10-20 00:57:06 +10:30
parent bd4bf53084
commit 0500b28aea

View File

@ -25,16 +25,15 @@ from gns3server.app import app
from httpx import AsyncClient
if sys.platform.startswith("win") and sys.version_info < (3, 8):
@pytest.yield_fixture(scope="session")
def event_loop(request):
"""
Overwrite pytest_asyncio event loop.
Overwrite pytest_asyncio event loop on Windows for Python < 3.8
As of Python 3.8, the default event loop on Windows is Proactor
"""
# As of Python 3.8, the default event loop on Windows is Proactor
if sys.platform.startswith("win") and sys.version_info < (3, 8):
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
loop = asyncio.get_event_loop_policy().new_event_loop()
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
yield loop
loop.close()