1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-24 15:58:08 +00:00

Do not try to use ProactorEventLoop() on non Windows platforms.

This commit is contained in:
grossmj 2020-06-16 18:45:11 +09:30
parent 8976384a56
commit 09e9382df1

View File

@ -22,15 +22,16 @@ from .handlers.api.base import Query
sys._called_from_test = True
sys.original_platform = sys.platform
@pytest.mark.skipif(not sys.platform.startswith("win"), reason="asyncio.ProactorEventLoop() is Only supported on Windows")
@pytest.yield_fixture(scope="session")
def loop(request):
"""Return an event loop and destroy it at the end of test"""
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop) # Replace main loop to avoid conflict between tests
yield loop
asyncio.set_event_loop(None)
if sys.platform.startswith("win"):
@pytest.yield_fixture(scope="session")
def loop(request):
"""Return an event loop and destroy it at the end of test"""
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop) # Replace main loop to avoid conflict between tests
yield loop
asyncio.set_event_loop(None)
@pytest.fixture(scope='function')