mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-16 04:18:35 +00:00
* feat: Add inject_date flag to Agent for automatic date injection Co-Authored-By: Joe Moura <joao@crewai.com> * feat: Add date_format parameter and error handling to inject_date feature Co-Authored-By: Joe Moura <joao@crewai.com> * fix: Update test implementation for inject_date feature Co-Authored-By: Joe Moura <joao@crewai.com> * fix: Add date format validation to prevent invalid formats Co-Authored-By: Joe Moura <joao@crewai.com> * docs: Update documentation for inject_date feature Co-Authored-By: Joe Moura <joao@crewai.com> * unnecesary * new tests --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura <joao@crewai.com> Co-authored-by: João Moura <joaomdmoura@gmail.com>
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
# conftest.py
|
|
import os
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from dotenv import load_dotenv
|
|
|
|
load_result = load_dotenv(override=True)
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def setup_test_environment():
|
|
"""Set up test environment with a temporary directory for SQLite storage."""
|
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
# Create the directory with proper permissions
|
|
storage_dir = Path(temp_dir) / "crewai_test_storage"
|
|
storage_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
# Validate that the directory was created successfully
|
|
if not storage_dir.exists() or not storage_dir.is_dir():
|
|
raise RuntimeError(
|
|
f"Failed to create test storage directory: {storage_dir}"
|
|
)
|
|
|
|
# Verify directory permissions
|
|
try:
|
|
# Try to create a test file to verify write permissions
|
|
test_file = storage_dir / ".permissions_test"
|
|
test_file.touch()
|
|
test_file.unlink()
|
|
except (OSError, IOError) as e:
|
|
raise RuntimeError(
|
|
f"Test storage directory {storage_dir} is not writable: {e}"
|
|
)
|
|
|
|
# Set environment variable to point to the test storage directory
|
|
os.environ["CREWAI_STORAGE_DIR"] = str(storage_dir)
|
|
|
|
yield
|
|
|
|
# Cleanup is handled automatically when tempfile context exits
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def vcr_config(request) -> dict:
|
|
return {
|
|
"cassette_library_dir": "tests/cassettes",
|
|
"record_mode": "new_episodes",
|
|
"filter_headers": [("authorization", "AUTHORIZATION-XXX")],
|
|
}
|