Spaces:
Runtime error
Runtime error
Download tests/support/mcp_plugin.py from GaryLeckey/aureon-os: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/GaryLeckey/aureon-os/resolve/main/tests/support/mcp_plugin.py
- Command line
-
hf download hf://spaces/GaryLeckey/aureon-os/tests/support/mcp_plugin.py
-
curl -L -o mcp_plugin.py https://huggingface.co/spaces/GaryLeckey/aureon-os/resolve/main/tests/support/mcp_plugin.py
1.49 kB
| """Pytest fixtures that keep the Space import guard inside MCP tests. | |
| Loaded from the repository conftest via pytest_plugins so tests/conftest.py | |
| does not shadow ``from conftest import``. | |
| """ | |
| from __future__ import annotations | |
| import os | |
| import pytest | |
| from tests.support import mcp_isolation | |
| def _mcp_module(request: pytest.FixtureRequest) -> bool: | |
| return mcp_isolation.is_mcp_test_module(request.module.__name__) | |
| def _mcp_public_imports(request: pytest.FixtureRequest) -> None: | |
| if not _mcp_module(request): | |
| try: | |
| yield | |
| finally: | |
| # Non-MCP modules (e.g. test_aureon_public_stage2/stage34/queen_stage8) | |
| # can still import aureon_public and install PinnedAureonFinder on | |
| # sys.meta_path. Drop it at module end so later in-process aureon | |
| # imports are not blob-checked against the pin. | |
| # Also drops the _BlockTrading finder at module end, for test isolation only; not a guard removal outside tests. | |
| mcp_isolation.teardown_guard_leaks() | |
| return | |
| env_before = dict(os.environ) | |
| mcp_isolation.load_public_test_bindings(request.module) | |
| try: | |
| yield | |
| finally: | |
| mcp_isolation.teardown_guard_leaks() | |
| os.environ.clear() | |
| os.environ.update(env_before) | |
| def _mcp_guard_session_teardown() -> None: | |
| yield | |
| mcp_isolation.teardown_guard_leaks() | |