mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
test: Use ChromaDB in-memory mode for tests to avoid file system issues
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -19,7 +19,16 @@ def temp_db_dir() -> Generator[Path, None, None]:
|
||||
"""Create a temporary directory for test databases."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
path = Path(tmpdir)
|
||||
yield path
|
||||
# Ensure directory exists and is writable
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
# Set ChromaDB to use in-memory mode for tests
|
||||
os.environ["CHROMA_IN_MEMORY"] = "true"
|
||||
try:
|
||||
yield path
|
||||
finally:
|
||||
# Clean up ChromaDB environment variable
|
||||
if "CHROMA_IN_MEMORY" in os.environ:
|
||||
del os.environ["CHROMA_IN_MEMORY"]
|
||||
|
||||
|
||||
def test_memory_reset_with_openai(temp_db_dir):
|
||||
|
||||
Reference in New Issue
Block a user