Spaces:
Paused
Paused
Download tests/test_retro/conftest.py from whassan/SensorflowStudio: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/whassan/SensorflowStudio/resolve/main/tests/test_retro/conftest.py
- Command line
-
hf download hf://spaces/whassan/SensorflowStudio/tests/test_retro/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/whassan/SensorflowStudio/resolve/main/tests/test_retro/conftest.py
1.25 kB
| """Shared fixtures for the retro (Agentic Retrospective Safety Analyzer) suite. | |
| - retro_root: function-scoped isolated runs/retro replacement (RETRO_RUNS_DIR). | |
| - fallback_index: forces the deterministic numpy/hashed-TF store so RAG tests | |
| never depend on chromadb's model download or ANN nondeterminism. | |
| - registry: audited tool registry bound to the isolated root. | |
| """ | |
| from __future__ import annotations | |
| import pytest | |
| import sensorflow.retro.rag.retriever as retriever_mod | |
| from sensorflow.retro.rag.retriever import SafetyCaseIndex | |
| from sensorflow.retro.rag.store import NumpyCosineStore | |
| from sensorflow.retro.tools.builtin import build_registry | |
| def retro_root(tmp_path, monkeypatch): | |
| root = tmp_path / "retro" | |
| monkeypatch.setenv("RETRO_RUNS_DIR", str(root)) | |
| return root | |
| def fallback_index(): | |
| return SafetyCaseIndex(store=NumpyCosineStore()) | |
| def _pin_fallback_index(fallback_index, monkeypatch): | |
| """All retro tests retrieve through the deterministic fallback index.""" | |
| monkeypatch.setattr(retriever_mod, "_INDEX", fallback_index) | |
| def registry(retro_root): | |
| return build_registry(analysis_id="test-analysis") | |