mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 03:08:27 +08:00
test: fix handling of missing devices
This commit is contained in:
parent
a061ba2505
commit
bf78e0c7d2
@ -1,3 +1,4 @@
|
||||
import unittest
|
||||
import asyncio
|
||||
|
||||
from artiq.coredevice.comm_moninj import *
|
||||
@ -6,9 +7,17 @@ from artiq.test.hardware_testbench import ExperimentCase
|
||||
|
||||
class MonInjTest(ExperimentCase):
|
||||
def test_moninj(self):
|
||||
core_host = self.device_mgr.get_desc("core")["arguments"]["host"]
|
||||
loop_out_channel = self.device_mgr.get_desc("loop_out")["arguments"]["channel"]
|
||||
loop_in_channel = self.device_mgr.get_desc("loop_in")["arguments"]["channel"]
|
||||
try:
|
||||
core = self.device_mgr.get_desc("core")
|
||||
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 = []
|
||||
injection_statuses = []
|
||||
|
@ -11,7 +11,7 @@ import time
|
||||
import socket
|
||||
|
||||
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.frontend.artiq_run import DummyScheduler
|
||||
from artiq.protocols.pc_rpc import AutoTarget, Client
|
||||
@ -113,12 +113,12 @@ class ExperimentCase(unittest.TestCase):
|
||||
exp = cls(
|
||||
(self.device_mgr, self.dataset_mgr, None),
|
||||
*args, **kwargs)
|
||||
exp.prepare()
|
||||
return exp
|
||||
except KeyError as e:
|
||||
except DeviceError as e:
|
||||
# skip if ddb does not match requirements
|
||||
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):
|
||||
expid = {
|
||||
|
Loading…
Reference in New Issue
Block a user