conftest.py
python
sha256:c87cf2c2f03da507f66f93922cb339a2cbebb33ad6372a6039032fb09a20da12
Reconcile reviewed Overseer recovery d47291d5d9030de5ebef71…
Human
minor
⚠ breaking
8 days ago
| 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 |
File History
1 commit
sha256:c87cf2c2f03da507f66f93922cb339a2cbebb33ad6372a6039032fb09a20da12
Reconcile reviewed Overseer recovery d47291d5d9030de5ebef71…
Human
minor
⚠
8 days ago