From ddb5d22d8dd99b7cea244ded2ed10be189c4392f Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 20 Jun 2025 16:44:51 +0800 Subject: [PATCH] fix: add marker for tests requiring node with modifications --- tests/conftest.py | 15 +++++++++++++++ .../test_dispersal_resilience.py | 1 + 2 files changed, 16 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index ea0920e..d6a8857 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -17,6 +17,21 @@ from src.data_storage import DS logger = get_custom_logger(__name__) +def pytest_addoption(parser): + parser.addoption("--run-with-mod-da-node", action="store_true", default=False, help="Run tests requiring nodes with modified da layer") + + +def pytest_configure(config): + config.addinivalue_line("markers", "mod_da_node: Mark test as requiring --run-with-mod-da-node") + + +def pytest_collection_modifyitems(config, items): + run_mod_da_node = config.getoption("--run-with-mod-da-node") + for item in items: + if "mod_da_node" in item.keywords and not run_mod_da_node: + item.add_marker(pytest.mark.skip(reason="Requires --run-with-mod-da-node option")) + + # See https://docs.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_makereport(item): diff --git a/tests/dispersal_resilience/test_dispersal_resilience.py b/tests/dispersal_resilience/test_dispersal_resilience.py index ecb1f6a..54e17e2 100644 --- a/tests/dispersal_resilience/test_dispersal_resilience.py +++ b/tests/dispersal_resilience/test_dispersal_resilience.py @@ -6,6 +6,7 @@ from src.steps.da import StepsDataAvailability from src.test_data import DATA_TO_DISPERSE +@pytest.mark.mod_da_node class TestDispersalResilience(StepsDataAvailability): main_nodes = []