Commit aebc184e authored by Federico Vaga's avatar Federico Vaga

tst: repalce fd-id with dev-id

to make it uniform with other projects
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 8dd82318
......@@ -42,16 +42,16 @@ def id_from_slot(slot):
devname = list(Path(pathfmc[0]).parent.glob("hw-fd-*/fd-*/devname"))
assert len(devname) == 1
with open(devname[0]) as f:
fd_id = int(f.read().strip().split("-")[1], 16)
return fd_id
dev_id = int(f.read().strip().split("-")[1], 16)
return dev_id
def pytest_generate_tests(metafunc):
if "fd_id" in metafunc.fixturenames:
metafunc.parametrize("fd_id", pytest.fd_id)
if "dev_id" in metafunc.fixturenames:
metafunc.parametrize("dev_id", pytest.dev_id)
@pytest.fixture(scope="function")
def fmcfd(fd_id):
fd = FmcFineDelay(fd_id)
def fmcfd(dev_id):
fd = FmcFineDelay(dev_id)
for ch in fd.chan:
ch.disable()
yield fd
......@@ -59,7 +59,7 @@ def fmcfd(fd_id):
chan.disable()
def pytest_addoption(parser):
parser.addoption("--fd-id", type=lambda x : int(x, 16), action='append',
parser.addoption("--id", type=lambda x : int(x, 16), action='append',
default=[], help="Fmc Fine-Delay Linux Identifier")
parser.addoption("--slot", type=valid_slot_type, action='append',
default=[], help="Fmc Fine-Delay absolute slot (works only for SPEC and SVEC)")
......@@ -68,15 +68,15 @@ def pytest_addoption(parser):
help="Channel(s) to be used for acquisition tests. Default all channels")
def pytest_configure(config):
pytest.fd_id = config.getoption("--fd-id")
if len(pytest.fd_id) == 0:
pytest.dev_id = config.getoption("--id")
if len(pytest.dev_id) == 0:
pytest.slot = config.getoption("--slot")
if len(pytest.slot) == 0:
print("Missing argument --fd-id or --slot")
print("Missing argument --id or --slot")
raise Exception()
pytest.fd_id = []
pytest.dev_id = []
for slot in pytest.slot:
pytest.fd_id.append(id_from_slot(slot))
pytest.dev_id.append(id_from_slot(slot))
pytest.channels = config.getoption("--channel")
if len(pytest.channels) == 0:
pytest.channels = range(FmcFineDelay.CHANNEL_NUMBER)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment