atlas-iac/testing/tests/conftest.py
jenkins 943ecfd15b Merge remote-tracking branch 'origin/feature/hermes-distributed-worker-pool' into feature/hermes-full-handoff-acceptance
# Conflicts:
#	ci/scripts/semgrep_report.py
#	testing/quality_contract.json
#	testing/quality_coverage.py
#	testing/tests/conftest.py
#	testing/tests/test_hermes_auto_router.py
#	testing/tests/test_quality_contract.py
#	testing/tests/test_quality_coverage_helpers.py
#	testing/tests/test_semgrep_report.py
2026-08-18 06:28:18 -03:00

41 lines
1.4 KiB
Python

"""Shared pytest boundaries and runtime-path fixtures for repository tests."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
@pytest.fixture(autouse=True)
def isolate_coordinator_gitea_token(
request: pytest.FixtureRequest,
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
"""Prevent coordinator tests from observing the mounted production token."""
if request.node.path.name == "test_hermes_coordinator.py":
monkeypatch.setenv(
"HERMES_GITEA_TOKEN_FILE", str(tmp_path / "absent-gitea-token")
)
@pytest.fixture(autouse=True)
def _patched_hermes_cli_db_contract(request, monkeypatch):
"""Keep legacy lane test doubles focused on their original safety boundary."""
module_name = request.module.__name__.rsplit(".", 1)[-1]
if not module_name.startswith("test_hermes_cli_") or module_name.endswith(
"capabilities"
):
return
capability_module = sys.modules.get("cli_lane_capabilities")
if capability_module is None:
return
safe = capability_module.KanbanCapabilities(True, True, True)
for name, module in tuple(sys.modules.items()):
if (
name == "cli_lane_runner" or name.startswith("cli_lane_")
) and hasattr(module, "kanban_capabilities"):
monkeypatch.setattr(module, "kanban_capabilities", lambda _db: safe)