|
"""
|
|
Pytest Configuration for Service Tests
|
|
|
|
Provides fixtures and configuration for integration testing.
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
project_root = Path(__file__).parent.parent
|
|
sys.path.insert(0, str(project_root / "src" / "api"))
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def test_config():
|
|
"""Provide test configuration."""
|
|
return {
|
|
"api_host": "http://localhost:8000",
|
|
"ai_host": "http://localhost:8001",
|
|
"viz_host": "http://localhost:8002",
|
|
"ml_host": "http://localhost:8003",
|
|
"timeout": 30
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def api_client():
|
|
"""Create API test client."""
|
|
try:
|
|
from api_c_integration import app
|
|
return TestClient(app)
|
|
except Exception as e:
|
|
print(f"Warning: Could not load API: {e}")
|
|
return None
|
|
|
|
|
|
@pytest.fixture
|
|
def ai_client():
|
|
"""Create AI service test client."""
|
|
try:
|
|
from ai_service import app
|
|
return TestClient(app)
|
|
except Exception as e:
|
|
print(f"Warning: Could not load AI service: {e}")
|
|
return None
|
|
|
|
|
|
@pytest.fixture
|
|
def viz_client():
|
|
"""Create visualization service test client."""
|
|
try:
|
|
from viz_service import app
|
|
return TestClient(app)
|
|
except Exception as e:
|
|
print(f"Warning: Could not load visualization service: {e}")
|
|
return None
|
|
|
|
|
|
@pytest.fixture
|
|
def ml_client():
|
|
"""Create ML service test client."""
|
|
try:
|
|
from ml_service import app
|
|
return TestClient(app)
|
|
except Exception as e:
|
|
print(f"Warning: Could not load ML service: {e}")
|
|
return None
|