forked from M-Labs/artiq
1
0
Fork 0

test: do not close/recreate the asyncio event loop (WA for asyncio bugs when multiple tests are run)

This commit is contained in:
Sebastien Bourdeauducq 2015-03-11 19:05:01 +01:00
parent e037b930d8
commit 4ba54ac929
2 changed files with 3 additions and 10 deletions

View File

@ -74,10 +74,7 @@ class RPCCase(unittest.TestCase):
def _loop_asyncio_echo(self): def _loop_asyncio_echo(self):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
try:
loop.run_until_complete(self._asyncio_echo()) loop.run_until_complete(self._asyncio_echo())
finally:
loop.close()
def test_asyncio_echo(self): def test_asyncio_echo(self):
self._run_server_and_test(self._loop_asyncio_echo) self._run_server_and_test(self._loop_asyncio_echo)

View File

@ -41,12 +41,8 @@ def _run_experiment(experiment):
} }
worker = Worker(handlers) worker = Worker(handlers)
loop = asyncio.new_event_loop() loop = asyncio.get_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(_call_worker(worker, run_params)) loop.run_until_complete(_call_worker(worker, run_params))
finally:
loop.close()
class WatchdogCase(unittest.TestCase): class WatchdogCase(unittest.TestCase):