28 lines
776 B
Python
28 lines
776 B
Python
"""Pytest configuration and fixtures."""
|
|
|
|
import os
|
|
from typing import Generator
|
|
|
|
import pytest
|
|
|
|
from aegis_gitea_mcp.config import reset_settings
|
|
from aegis_gitea_mcp.audit import reset_audit_logger
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def reset_globals() -> Generator[None, None, None]:
|
|
"""Reset global singletons between tests."""
|
|
yield
|
|
reset_settings()
|
|
reset_audit_logger()
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_env(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
"""Set up mock environment variables for testing."""
|
|
monkeypatch.setenv("GITEA_URL", "https://gitea.example.com")
|
|
monkeypatch.setenv("GITEA_TOKEN", "test-token-12345")
|
|
monkeypatch.setenv("MCP_HOST", "0.0.0.0")
|
|
monkeypatch.setenv("MCP_PORT", "8080")
|
|
monkeypatch.setenv("LOG_LEVEL", "DEBUG")
|