From 132f8eb4d88b3aefa7206eeace8c88b8a7e899e2 Mon Sep 17 00:00:00 2001 From: Jose Tiago Macara Coutinho Date: Fri, 26 Jan 2018 17:59:16 +0100 Subject: [PATCH] pepu: add command line argument to test specific pepu hostname --- tests/controllers_hw/conftest.py | 21 +++++++++++++++++++++ tests/controllers_hw/pepu.py | 7 +++++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/controllers_hw/conftest.py diff --git a/tests/controllers_hw/conftest.py b/tests/controllers_hw/conftest.py new file mode 100644 index 000000000..cdd647ab8 --- /dev/null +++ b/tests/controllers_hw/conftest.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# +# This file is part of the bliss project +# +# Copyright (c) 2016 Beamline Control Unit, ESRF +# Distributed under the GNU LGPLv3. See LICENSE for more info. + +import pytest + + +def pytest_addoption(parser): + parser.addoption("--pepu", help="pepu host name") + + +def pytest_collection_modifyitems(config, items): + if config.getoption('--pepu') is None: + for item in list(items): + if 'pepu' in item.keywords: + items.remove(item) + + diff --git a/tests/controllers_hw/pepu.py b/tests/controllers_hw/pepu.py index 29163c92f..248b952d1 100644 --- a/tests/controllers_hw/pepu.py +++ b/tests/controllers_hw/pepu.py @@ -10,10 +10,13 @@ Run with: import pytest from bliss.controllers.pepu import PEPU, Signal, Trigger +pytestmark = pytest.mark.pepu + @pytest.fixture -def pepu(): - pepu = PEPU('test', {'tcp': {'url': 'pepudcm2'}}) +def pepu(request): + hostname = request.config.getoption('--pepu') + pepu = PEPU('test', {'tcp': {'url': hostname}}) try: pepu.calc_channels[1].formula = '1.5' pepu.calc_channels[2].formula = '-1.5' -- GitLab