From 4ba54ac92975c3f7c8f24423ec4d888e8c8e3e58 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 11 Mar 2015 19:05:01 +0100 Subject: [PATCH] test: do not close/recreate the asyncio event loop (WA for asyncio bugs when multiple tests are run) --- artiq/test/pc_rpc.py | 5 +---- artiq/test/worker.py | 8 ++------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/artiq/test/pc_rpc.py b/artiq/test/pc_rpc.py index 566b81cbb..bbd4dde80 100644 --- a/artiq/test/pc_rpc.py +++ b/artiq/test/pc_rpc.py @@ -74,10 +74,7 @@ class RPCCase(unittest.TestCase): def _loop_asyncio_echo(self): loop = asyncio.get_event_loop() - try: - loop.run_until_complete(self._asyncio_echo()) - finally: - loop.close() + loop.run_until_complete(self._asyncio_echo()) def test_asyncio_echo(self): self._run_server_and_test(self._loop_asyncio_echo) diff --git a/artiq/test/worker.py b/artiq/test/worker.py index 51bd35597..5d3aad34d 100644 --- a/artiq/test/worker.py +++ b/artiq/test/worker.py @@ -41,12 +41,8 @@ def _run_experiment(experiment): } worker = Worker(handlers) - loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) - try: - loop.run_until_complete(_call_worker(worker, run_params)) - finally: - loop.close() + loop = asyncio.get_event_loop() + loop.run_until_complete(_call_worker(worker, run_params)) class WatchdogCase(unittest.TestCase):