forked from M-Labs/artiq
test: fix handling of missing devices
This commit is contained in:
parent
a061ba2505
commit
bf78e0c7d2
|
@ -1,3 +1,4 @@
|
||||||
|
import unittest
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from artiq.coredevice.comm_moninj import *
|
from artiq.coredevice.comm_moninj import *
|
||||||
|
@ -6,9 +7,17 @@ from artiq.test.hardware_testbench import ExperimentCase
|
||||||
|
|
||||||
class MonInjTest(ExperimentCase):
|
class MonInjTest(ExperimentCase):
|
||||||
def test_moninj(self):
|
def test_moninj(self):
|
||||||
core_host = self.device_mgr.get_desc("core")["arguments"]["host"]
|
try:
|
||||||
loop_out_channel = self.device_mgr.get_desc("loop_out")["arguments"]["channel"]
|
core = self.device_mgr.get_desc("core")
|
||||||
loop_in_channel = self.device_mgr.get_desc("loop_in")["arguments"]["channel"]
|
loop_out = self.device_mgr.get_desc("loop_out")
|
||||||
|
loop_in = self.device_mgr.get_desc("loop_in")
|
||||||
|
except KeyError as e:
|
||||||
|
# skip if ddb does not match requirements
|
||||||
|
raise unittest.SkipTest(
|
||||||
|
"test device not available: `{}`".format(*e.args))
|
||||||
|
core_host = core["arguments"]["host"]
|
||||||
|
loop_out_channel = loop_out["arguments"]["channel"]
|
||||||
|
loop_in_channel = loop_in["arguments"]["channel"]
|
||||||
|
|
||||||
notifications = []
|
notifications = []
|
||||||
injection_statuses = []
|
injection_statuses = []
|
||||||
|
|
|
@ -11,7 +11,7 @@ import time
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
from artiq.master.databases import DeviceDB, DatasetDB
|
from artiq.master.databases import DeviceDB, DatasetDB
|
||||||
from artiq.master.worker_db import DeviceManager, DatasetManager
|
from artiq.master.worker_db import DeviceManager, DatasetManager, DeviceError
|
||||||
from artiq.coredevice.core import CompileError
|
from artiq.coredevice.core import CompileError
|
||||||
from artiq.frontend.artiq_run import DummyScheduler
|
from artiq.frontend.artiq_run import DummyScheduler
|
||||||
from artiq.protocols.pc_rpc import AutoTarget, Client
|
from artiq.protocols.pc_rpc import AutoTarget, Client
|
||||||
|
@ -113,12 +113,12 @@ class ExperimentCase(unittest.TestCase):
|
||||||
exp = cls(
|
exp = cls(
|
||||||
(self.device_mgr, self.dataset_mgr, None),
|
(self.device_mgr, self.dataset_mgr, None),
|
||||||
*args, **kwargs)
|
*args, **kwargs)
|
||||||
exp.prepare()
|
except DeviceError as e:
|
||||||
return exp
|
|
||||||
except KeyError as e:
|
|
||||||
# skip if ddb does not match requirements
|
# skip if ddb does not match requirements
|
||||||
raise unittest.SkipTest(
|
raise unittest.SkipTest(
|
||||||
"device_db entry `{}` not found".format(*e.args))
|
"test device not available: `{}`".format(*e.args))
|
||||||
|
exp.prepare()
|
||||||
|
return exp
|
||||||
|
|
||||||
def execute(self, cls, *args, **kwargs):
|
def execute(self, cls, *args, **kwargs):
|
||||||
expid = {
|
expid = {
|
||||||
|
|
Loading…
Reference in New Issue