From 78df4915cf41e6fed0a8dc783102728e72825253 Mon Sep 17 00:00:00 2001 From: merwanehamadi Date: Wed, 12 Jul 2023 14:35:12 -0700 Subject: [PATCH] Remove dependencies if a specific test is asked by the user (#95) Signed-off-by: Merwane Hamadi --- agbenchmark/conftest.py | 3 +++ agbenchmark/start_benchmark.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/agbenchmark/conftest.py b/agbenchmark/conftest.py index b91b5f9f..32151b8a 100644 --- a/agbenchmark/conftest.py +++ b/agbenchmark/conftest.py @@ -85,6 +85,7 @@ def pytest_addoption(parser: Any) -> None: parser.addoption("--mock", action="store_true", default=False) parser.addoption("--improve", action="store_true", default=False) parser.addoption("--maintain", action="store_true", default=False) + parser.addoption("--test", action="store_true", default=None) @pytest.fixture(autouse=True) @@ -232,6 +233,8 @@ def pytest_collection_modifyitems(items: Any, config: Any) -> None: # Filter dependencies if they exist in regression data if its an improvement test if config.getoption("--improve"): dependencies = [dep for dep in dependencies if not data.get(dep, None)] + elif config.getoption("--test"): + dependencies = [] categories = test_class_instance.data.category diff --git a/agbenchmark/start_benchmark.py b/agbenchmark/start_benchmark.py index 917cd4e8..ab2586e6 100644 --- a/agbenchmark/start_benchmark.py +++ b/agbenchmark/start_benchmark.py @@ -94,7 +94,7 @@ def start(category: str, test: str, maintain: bool, improve: bool, mock: bool) - pytest_args = ["-vs"] if test: print("Running specific test:", test) - pytest_args.extend(["-k", test]) + pytest_args.extend(["-k", test, "--test"]) else: if category: pytest_args.extend(["-m", category])