Spaces:
Running
Running
File size: 1,683 Bytes
9a6a4dc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
"""
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 |