51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
"""
|
|
Governance Test Configuration
|
|
|
|
Shared fixtures for all governance tests.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import pytest
|
|
from pathlib import Path
|
|
|
|
# Add packages to path
|
|
REPO_ROOT = Path(__file__).parents[2]
|
|
sys.path.insert(0, str(REPO_ROOT / "packages"))
|
|
|
|
# Set VaultMesh root
|
|
os.environ["VAULTMESH_ROOT"] = str(REPO_ROOT)
|
|
|
|
|
|
@pytest.fixture
|
|
def repo_root():
|
|
"""Return the repository root path."""
|
|
return REPO_ROOT
|
|
|
|
|
|
@pytest.fixture
|
|
def constitution_path(repo_root):
|
|
"""Return path to the constitution."""
|
|
return repo_root / "docs" / "MCP-CONSTITUTION.md"
|
|
|
|
|
|
@pytest.fixture
|
|
def constitution_lock_path(repo_root):
|
|
"""Return path to the constitution lock file."""
|
|
return repo_root / "governance" / "constitution.lock"
|
|
|
|
|
|
@pytest.fixture
|
|
def parse_lock_file(constitution_lock_path):
|
|
"""Parse the constitution lock file into a dict."""
|
|
lock = {}
|
|
with open(constitution_lock_path, "r") as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
if not line or line.startswith("#"):
|
|
continue
|
|
if "=" in line:
|
|
key, value = line.split("=", 1)
|
|
lock[key.strip()] = value.strip()
|
|
return lock
|