conftest.py file-level

at main · View file ↗ · Intel ↗

History
1 files
1 commits
0 hotspots
0 🧊 dead
0 💥 blast risk
sha256:f docs: recenter public story on governance loop · · Oct 11, 2026
1 """Opt-in real Muse matrix: selecting this directory requires a Muse venv."""
2 import os
3 from pathlib import Path
4 import subprocess
5
6 import pytest
7
8
9 def pytest_addoption(parser):
10 parser.addoption('--muse-python', help='Absolute Python in a separate Muse 0.2.1rc5 venv')
11
12
13 @pytest.fixture(scope='session')
14 def muse_python(request):
15 value = request.config.getoption('--muse-python')
16 if not value:
17 pytest.fail('Real Muse matrix requires --muse-python; Git-only matrix is tests/v1 + tests/retained')
18 path = Path(value)
19 assert path.is_absolute() and path.exists()
20 return path
21
22
23 @pytest.fixture
24 def muse(muse_python):
25 def run(root, *args):
26 env = {k: v for k, v in os.environ.items() if not k.startswith(('MUSE_', 'GIT_', 'PYTHON'))}
27 env.update(PYTHONDONTWRITEBYTECODE='1', GIT_CONFIG_GLOBAL='/dev/null',
28 GIT_CONFIG_NOSYSTEM='1', GIT_AUTHOR_NAME='Fixture',
29 GIT_AUTHOR_EMAIL='[email protected]', GIT_COMMITTER_NAME='Fixture',
30 GIT_COMMITTER_EMAIL='[email protected]')
31 result = subprocess.run([str(muse_python.parent / 'muse'), '-C', str(root), *args],
32 env=env, text=True, capture_output=True, timeout=30)
33 assert result.returncode == 0, result.stdout + result.stderr
34 return result
35 return run
36
37
38 @pytest.fixture
39 def muse_root(tmp_path, muse):
40 root = (tmp_path / 'muse-only').resolve()
41 root.mkdir()
42 muse(root, 'init', '--domain', 'code', '--json')
43 return root