fix: resolve Pydantic v2 compatibility and conftest path issues
- Remove duplicate Config class from BaseAITBCConfig (Pydantic v2 compatibility) - Update conftest.py to use DATA_DIR and LOG_DIR constants directly - Fix TypeError: get_log_path() missing required argument - Tests now run successfully with PYTHONPATH set
This commit is contained in:
@@ -41,12 +41,6 @@ class BaseAITBCConfig(BaseSettings):
|
|||||||
default="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
default="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||||
description="Log format string"
|
description="Log format string"
|
||||||
)
|
)
|
||||||
|
|
||||||
class Config:
|
|
||||||
"""Pydantic configuration"""
|
|
||||||
env_file = str(ENV_FILE)
|
|
||||||
env_file_encoding = "utf-8"
|
|
||||||
case_sensitive = False
|
|
||||||
|
|
||||||
|
|
||||||
class AITBCConfig(BaseAITBCConfig):
|
class AITBCConfig(BaseAITBCConfig):
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ sys.path.insert(0, str(project_root))
|
|||||||
sys.path.insert(0, str(project_root / "aitbc"))
|
sys.path.insert(0, str(project_root / "aitbc"))
|
||||||
|
|
||||||
# Import aitbc utilities for conftest
|
# Import aitbc utilities for conftest
|
||||||
from aitbc import get_data_path, get_log_path
|
from aitbc import DATA_DIR, LOG_DIR
|
||||||
|
|
||||||
# Add necessary source paths
|
# Add necessary source paths
|
||||||
sys.path.insert(0, str(project_root / "packages" / "py" / "aitbc-core" / "src"))
|
sys.path.insert(0, str(project_root / "packages" / "py" / "aitbc-core" / "src"))
|
||||||
@@ -50,9 +50,9 @@ sys.path.insert(0, str(project_root / "apps" / "coordinator-api"))
|
|||||||
|
|
||||||
# Set up test environment
|
# Set up test environment
|
||||||
os.environ["TEST_MODE"] = "true"
|
os.environ["TEST_MODE"] = "true"
|
||||||
os.environ["AUDIT_LOG_DIR"] = str(get_log_path() / "audit")
|
os.environ["AUDIT_LOG_DIR"] = str(LOG_DIR / "audit")
|
||||||
os.environ["TEST_DATABASE_URL"] = "sqlite:///:memory:"
|
os.environ["TEST_DATABASE_URL"] = "sqlite:///:memory:"
|
||||||
os.environ["DATA_DIR"] = str(get_data_path())
|
os.environ["DATA_DIR"] = str(DATA_DIR)
|
||||||
|
|
||||||
# Mock missing optional dependencies
|
# Mock missing optional dependencies
|
||||||
sys.modules['slowapi'] = Mock()
|
sys.modules['slowapi'] = Mock()
|
||||||
|
|||||||
Reference in New Issue
Block a user