From 4a16ea111c7fe9522d334d8d7a41cc1276338e8f Mon Sep 17 00:00:00 2001 From: Yann Sionneau Date: Thu, 27 Aug 2015 18:23:26 +0200 Subject: [PATCH] worker, scheduler: fix unit tests on Windows --- artiq/test/scheduler.py | 6 +++++- artiq/test/worker.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/artiq/test/scheduler.py b/artiq/test/scheduler.py index a3783863e..33e712fb5 100644 --- a/artiq/test/scheduler.py +++ b/artiq/test/scheduler.py @@ -1,6 +1,7 @@ import unittest import asyncio import sys +import os from time import time, sleep from artiq import * @@ -63,7 +64,10 @@ _handlers = { class SchedulerCase(unittest.TestCase): def setUp(self): - self.loop = asyncio.new_event_loop() + if os.name == "nt": + self.loop = asyncio.ProactorEventLoop() + else: + self.loop = asyncio.new_event_loop() asyncio.set_event_loop(self.loop) def test_steps(self): diff --git a/artiq/test/worker.py b/artiq/test/worker.py index abb321e27..b00660188 100644 --- a/artiq/test/worker.py +++ b/artiq/test/worker.py @@ -1,6 +1,7 @@ import unittest import asyncio import sys +import os from time import sleep from artiq import * @@ -59,7 +60,10 @@ def _run_experiment(class_name): class WatchdogCase(unittest.TestCase): def setUp(self): - self.loop = asyncio.new_event_loop() + if os.name == "nt": + self.loop = asyncio.ProactorEventLoop() + else: + self.loop = asyncio.new_event_loop() asyncio.set_event_loop(self.loop) def test_watchdog_no_timeout(self):