Commit c705a653 authored by Federico Vaga's avatar Federico Vaga

tst: remove SCPI usage - keep class

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 83bc07de
...@@ -101,18 +101,10 @@ class FmcFineDelay(PulseGenerator): ...@@ -101,18 +101,10 @@ class FmcFineDelay(PulseGenerator):
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def fmcfd(): def fmcfd():
if pytest.fd_id is not None: gen = FmcFineDelay(pytest.fd_id)
gen = FmcFineDelay(pytest.fd_id)
elif pytest.scpi is not None:
gen = SCPI(pytest.scpi)
yield gen yield gen
for ch in range(FmcFineDelay.CHANNEL_NUMBER):
if isinstance(gen, FmcFineDelay): gen.disable(ch + 1)
for ch in range(FmcFineDelay.CHANNEL_NUMBER):
gen.disable(ch + 1)
elif isinstance(gen, SCPI):
gen.disable(0)
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def fmctdc(): def fmctdc():
...@@ -129,8 +121,6 @@ def pytest_addoption(parser): ...@@ -129,8 +121,6 @@ def pytest_addoption(parser):
required=True, help="Fmc TDC Linux Identifier") required=True, help="Fmc TDC Linux Identifier")
parser.addoption("--fd-id", type=lambda x : int(x, 16), default=None, parser.addoption("--fd-id", type=lambda x : int(x, 16), default=None,
help="Fmc Fine-Delay Linux Identifier") help="Fmc Fine-Delay Linux Identifier")
parser.addoption("--scpi", type=str, default=None,
help="SCPI Connection String")
parser.addoption("--dump-range", type=int, default=10, parser.addoption("--dump-range", type=int, default=10,
help="Timestamps to show before and after an error") help="Timestamps to show before and after an error")
parser.addoption("--channel", type=int, default=[], parser.addoption("--channel", type=int, default=[],
...@@ -143,16 +133,22 @@ def pytest_addoption(parser): ...@@ -143,16 +133,22 @@ def pytest_addoption(parser):
def pytest_configure(config): def pytest_configure(config):
pytest.tdc_id = config.getoption("--tdc-id") pytest.tdc_id = config.getoption("--tdc-id")
if len(pytest.tdc_id) == 0:
print("Missing argument --tdc-id")
raise Exception()
pytest.fd_id = config.getoption("--fd-id") pytest.fd_id = config.getoption("--fd-id")
pytest.scpi = config.getoption("--scpi") if len(pytest.tdc_id) == 0:
if pytest.scpi is None and pytest.fd_id is None: print("Missing argument --fd-id")
raise Exception("You must set --fd-id or --scpi") raise Exception()
if len(pytest.tdc_id) != len(pytest.fd_id):
print("For each --fd-id there must be a --tdc-id")
raise Exception()
pytest.fd_tdc_id = zip(pytest.fd_id, pytest.tdc_id)
pytest.channels = config.getoption("--channel") pytest.channels = config.getoption("--channel")
if len(pytest.channels) == 0: if len(pytest.channels) == 0:
pytest.channels = range(FmcTdc.CHANNEL_NUMBER) pytest.channels = range(FmcTdc.CHANNEL_NUMBER)
if len(pytest.channels) != 1 and pytest.scpi is not None:
raise Exception("With --scpi we can test only the channel connected to the Waveform generator. Set --channel")
pytest.usr_acq = (config.getoption("--usr-acq-period-ns"), pytest.usr_acq = (config.getoption("--usr-acq-period-ns"),
config.getoption("--usr-acq-count")) config.getoption("--usr-acq-count"))
......
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