conftest.py
python
sha256:660fcac1df3ab28f61862e961890bd2ca8b754fa0242079d93ca1e25037ec8a6
chore(tests): add docstring to tests/__init__.py so rc14 tr…
Human
26 days ago
| 1 | """Pytest configuration and shared fixtures for the muse test suite. |
| 2 | |
| 3 | All fixtures defined here are automatically available to every test module |
| 4 | in the ``tests/`` directory without explicit import. |
| 5 | """ |
| 6 | |
| 7 | from __future__ import annotations |
| 8 | |
| 9 | import os |
| 10 | from typing import Generator |
| 11 | |
| 12 | import pytest |
| 13 | |
| 14 | |
| 15 | @pytest.fixture(autouse=True) |
| 16 | def _restore_cwd() -> Generator[None, None, None]: |
| 17 | """Restore the working directory and MUSE_REPO_ROOT after every test. |
| 18 | |
| 19 | Several tests call ``os.chdir()`` to enter a temporary repository, and |
| 20 | some directly mutate ``os.environ["MUSE_REPO_ROOT"]`` without cleanup. |
| 21 | Without this fixture those side-effects leak into subsequent tests, |
| 22 | causing ``find_repo_root()`` to resolve against a stale path and |
| 23 | producing spurious failures across the entire suite. |
| 24 | |
| 25 | Note: module-scoped fixtures that set these values run *before* this |
| 26 | function-scoped fixture captures them, so they must manage their own |
| 27 | cleanup (yield + restore in the fixture body). |
| 28 | """ |
| 29 | original_cwd = os.getcwd() |
| 30 | original_root = os.environ.get("MUSE_REPO_ROOT") |
| 31 | yield |
| 32 | os.chdir(original_cwd) |
| 33 | if original_root is None: |
| 34 | os.environ.pop("MUSE_REPO_ROOT", None) |
| 35 | else: |
| 36 | os.environ["MUSE_REPO_ROOT"] = original_root |
File History
5 commits
sha256:660fcac1df3ab28f61862e961890bd2ca8b754fa0242079d93ca1e25037ec8a6
chore(tests): add docstring to tests/__init__.py so rc14 tr…
Human
26 days ago
sha256:d8316ffae901be06347e16ab55be11868eb519dd16ade3e8aa16a99e662f7e62
baseline: rc14 re-baseline after rc3 store corruption recovery
Human
patch
26 days ago
sha256:50d413a635f57761c3fce1f70251b957b6423821525bf330747ef4007339222e
Merge branch 'dev' into main
Human
29 days ago
sha256:fb67fed5a4d3e40de84bdd163de94ef1386570bef1dd1a020a732c8a038962ce
Merge branch 'dev' into main
Human
48 days ago
sha256:1c4b3e3a9a1f300774c3ee662b572a698d5fd405bf765a71e6011a2e9c3eaaaa
feat: Muse — version control for the agent era
Human
101 days ago