""" Test configuration for GAIA Agent testing. Configures environment and suppresses warnings for clean test output. """ import os import pytest import logging import warnings import sys from pathlib import Path # Add the deployment-ready directory to the path sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # Import environment setup from utils.environment_setup import setup_test_environment def pytest_configure(config): """Configure pytest with clean environment.""" # Setup test environment with suppressed warnings setup_test_environment() # Suppress specific warnings warnings.filterwarnings('ignore', category=UserWarning) warnings.filterwarnings('ignore', category=FutureWarning) warnings.filterwarnings('ignore', category=DeprecationWarning) # Suppress transformers warnings logging.getLogger('transformers').setLevel(logging.ERROR) logging.getLogger('transformers.modeling_utils').setLevel(logging.ERROR) # Set environment variables for clean testing os.environ['SUPPRESS_WARNINGS'] = 'true' os.environ['LOG_LEVEL'] = 'ERROR' os.environ['TOKENIZERS_PARALLELISM'] = 'false' print("✅ Test environment configured with suppressed warnings") @pytest.fixture(scope="session", autouse=True) def setup_test_session(): """Setup test session with clean environment.""" # Ensure clean test environment setup_test_environment() # Additional test-specific setup yield # Cleanup after tests pass @pytest.fixture def suppress_output(capfd): """Fixture to suppress stdout/stderr during tests.""" with capfd.disabled(): yield