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.
Dynamic workspace path (#56)
Silen Naihinbfc7dfdb2910
diff --git a/agbenchmark/conftest.py b/agbenchmark/conftest.pyindex 613565fd26..66ede2c08c 100644--- a/agbenchmark/conftest.py+++ b/agbenchmark/conftest.py@@ -1,6 +1,7 @@import jsonimport osimport shutil+from pathlib import Path # noqafrom typing import Any, Dict, Generator, Listimport pytest@@ -9,6 +10,21 @@ from agbenchmark.start_benchmark import CONFIG_PATH, REGRESSION_TESTS_PATHfrom agbenchmark.tests.regression.RegressionManager import RegressionManager+def get_dynamic_workspace(config: Dict[str, Any]) -> str:+ # Extract the string inside ${...}+ path_expr = config["workspace"][2:-1]++ # Check if it starts with "os.path.join"+ if path_expr.strip().startswith("os.path.join"):+ # Evaluate the path string+ path_value = eval(path_expr)++ # Replace the original string with the evaluated result+ return path_value+ else:+ raise ValueError("Invalid workspace path expression.")++@pytest.fixture(scope="module")def config(request: Any) -> None:print(f"Config file: {CONFIG_PATH}")@@ -17,11 +33,16 @@ def config(request: Any) -> None:if request.config.getoption("--mock"):config["workspace"] = "agbenchmark/mocks/workspace"+ elif config.get("workspace", "").startswith("${") and config.get(+ "workspace", ""+ ).endswith("}"):+ path = get_dynamic_workspace(config)+ config["workspace"] = pathreturn config[email protected](scope="module")[email protected](scope="module", autouse=True)def workspace(config: Dict[str, Any]) -> Generator[str, None, None]:yield config["workspace"]# teardown after test function completesdiff --git a/agent/mini-agi b/agent/mini-agiindex d99220c058..4af8a7e608 160000--- a/agent/mini-agi+++ b/agent/mini-agi@@ -1 +1 @@-Subproject commit d99220c058c9fb45f83256ea361b55dba506fa75+Subproject commit 4af8a7e6085f0518f06180fbf87024a2c9db4c88diff --git a/regression_tests.json b/regression_tests.jsonindex 853c38dcb8..d0a8ed19d1 100644--- a/regression_tests.json+++ b/regression_tests.json@@ -26,4 +26,4 @@"dependencies": [],"test": "agbenchmark/challenges/retrieval/r3/r3_test.py"}-}\ No newline at end of file+}