diff --git a/setup.cfg b/setup.cfg index df7dadc29fd567cdf04af81d7814c06893dccd4a..e106b66ce498ac8a958ee201fe44e96f20358dbc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,8 +7,7 @@ source = ska_tango_base [tool:pytest] testpaths = tests -addopts = --forked - --verbose +addopts = --verbose --json-report --json-report-file=build/htmlcov/report.json --cov-report term diff --git a/tests/conftest.py b/tests/conftest.py index 4039cb3036e0915ab9cd88b59ecf4985f90c5766..461ee070c8455a27bb7fe0f051c85fe5b5ec94a6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,6 +34,10 @@ def tango_context(device_test_config): yield tango_context tango_context.stop() +def pytest_itemcollected(item): + """Make Tango-related tests run in forked mode""" + if "tango_context" in item.fixturenames: + item.add_marker("forked") @pytest.fixture(scope="function") def initialize_device(tango_context): diff --git a/tests/test_csp_master.py b/tests/test_csp_master.py index e911d6d9779e57e1c60d3eea0fd46b2b5e734613..954a97786873db1c606bc6def82f49534063c4ee 100644 --- a/tests/test_csp_master.py +++ b/tests/test_csp_master.py @@ -366,6 +366,7 @@ class TestCspSubElementMaster(object): # PROTECTED REGION END # // CspSubelementMaster.test_ReInitDevices_when_in_wrong_state +@pytest.mark.forked def test_multiple_devices_in_same_process(): # The order here is important - base class last, so that we can diff --git a/tests/test_csp_obs_device.py b/tests/test_csp_obs_device.py index 32355164e00ffd78a08bdc34b3143b4b547e15a9..5ef30ab4c475ca4cff8c31618a7d10d98d454aa5 100644 --- a/tests/test_csp_obs_device.py +++ b/tests/test_csp_obs_device.py @@ -410,6 +410,7 @@ class TestCspSubElementObsDevice(object): # PROTECTED REGION END # // CspSubelementObsDevice.test_Abort +@pytest.mark.forked def test_multiple_devices_in_same_process(): devices_info = ( {"class": CspSubElementObsDevice, "devices": [{"name": "test/se/1"}]}, diff --git a/tests/test_logger_device.py b/tests/test_logger_device.py index 47cde803e03f1e43f7a525618abee2d747a1ebc6..ea85f8571d41a26a52367b87844516c02332d021 100644 --- a/tests/test_logger_device.py +++ b/tests/test_logger_device.py @@ -159,6 +159,7 @@ class TestSKALogger(object): # PROTECTED REGION END # // SKALogger.test_testMode +@pytest.mark.forked def test_SetLoggingLevel(): """Test for SetLoggingLevel""" logging_level = int(tango.LogLevel.LOG_ERROR) diff --git a/tests/test_obs_device.py b/tests/test_obs_device.py index c19adf7e8351878ce963554fbb37ca54270ca064..02eb54320f220a07934323072661467800ff9322 100644 --- a/tests/test_obs_device.py +++ b/tests/test_obs_device.py @@ -187,6 +187,7 @@ class TestSKAObsDevice(object): # PROTECTED REGION END # // SKAObsDevice.test_testMode +@pytest.mark.forked def test_multiple_devices_in_same_process(): # The order here is important - base class last, so that we can