Enter terminal mode when review_pr/merge_pr capability is denied. Block reviewer queue tools (list_prs, eligibility checks) and add report-purity validators for forbidden PR selection, fallback, and empty-queue claims. Closes #197 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
"""Shared pytest fixtures for the Gitea-Tools test suite."""
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
sys.path.insert(0, str(__import__("pathlib").Path(__file__).resolve().parent.parent))
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _reset_mutation_authority(monkeypatch):
|
|
"""Isolate the in-process mutation authority between tests (#199).
|
|
|
|
The mutation-authority gate stays LIVE in every test — this fixture only
|
|
clears the per-process record and the session profile lock so one test's
|
|
seeded authority (or an intentionally mismatched one) cannot leak into
|
|
the next test. It must never replace verify_mutation_authority with a
|
|
no-op: individual tests that need a specific authority state set it up
|
|
explicitly.
|
|
"""
|
|
monkeypatch.delenv("GITEA_SESSION_PROFILE_LOCK", raising=False)
|
|
try:
|
|
import mcp_server
|
|
except Exception:
|
|
yield
|
|
return
|
|
monkeypatch.setattr(mcp_server, "_MUTATION_AUTHORITY", None)
|
|
monkeypatch.setattr(mcp_server, "_IDENTITY_CACHE", {})
|
|
monkeypatch.setattr(mcp_server, "_REVIEW_DECISION_LOCK", None)
|
|
try:
|
|
import capability_stop_terminal
|
|
capability_stop_terminal.clear()
|
|
except Exception:
|
|
pass
|
|
yield
|
|
try:
|
|
import capability_stop_terminal
|
|
capability_stop_terminal.clear()
|
|
except Exception:
|
|
pass
|