Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Remove dependencies if a specific test is asked by the user (#95)

merwanehamadi78df4915cf41
diff --git a/agbenchmark/conftest.py b/agbenchmark/conftest.py
index b91b5f9f8f..32151b8ad5 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 917cd4e8aa..ab2586e606 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])