Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

feat(tests): BaseIntegrationTestWithCache

Amir Mehr35dcaed2e1b0
diff --git a/tests_integration/base.py b/tests_integration/base.py
new file mode 100644
index 000000000..ef079d9e3
--- /dev/null
+++ b/tests_integration/base.py
@@ -0,0 +1,17 @@
+import os
+from pathlib import Path
+
+import pytest
+
+
+class BaseIntegrationTestWithCache:
+ @pytest.fixture(autouse=True)
+ def setup(self) -> None:
+ # Base directory for all DSPy modules
+ library_dir = Path(__file__).resolve().parent
+ base_dir = library_dir.parent
+ cache_dir = str(base_dir / "cache")
+ os.environ["DSP_NOTEBOOK_CACHEDIR"] = cache_dir
+
+ if cache_dir and not Path(cache_dir).exists():
+ Path(cache_dir).mkdir(parents=True)