Spaces:
Paused
Paused
Download tests/test_rotr/conftest.py from whassan/SensorflowStudio: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/whassan/SensorflowStudio/resolve/main/tests/test_rotr/conftest.py
- Command line
-
hf download hf://spaces/whassan/SensorflowStudio/tests/test_rotr/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/whassan/SensorflowStudio/resolve/main/tests/test_rotr/conftest.py
1.47 kB
| """Isolated persistence roots per test (rotr always; studio2/agentic when | |
| importable, since the flywheel/stop-ship mirror into them best-effort).""" | |
| from __future__ import annotations | |
| import pytest | |
| from sensorflow.rotr import store as rotr_store | |
| def rotr_env(tmp_path): | |
| rotr_store.set_rotr_root(str(tmp_path / "rotr")) | |
| restores = [] | |
| try: | |
| from sensorflow.studio2 import store as s2_store | |
| old = s2_store.STUDIO2_ROOT | |
| s2_store.set_studio2_root(str(tmp_path / "studio2")) | |
| restores.append(lambda: s2_store.set_studio2_root(old)) | |
| except Exception: | |
| pass | |
| try: | |
| from sensorflow.agentic import store as ag_store | |
| old_ag = ag_store.agentic_root() | |
| ag_store.set_agentic_root(str(tmp_path / "agentic")) | |
| restores.append(lambda: ag_store.set_agentic_root(old_ag)) | |
| except Exception: | |
| pass | |
| yield | |
| rotr_store.set_rotr_root("runs/rotr") | |
| for r in restores: | |
| r() | |
| def bank_v1(): | |
| """Deterministic in-memory bank (no store dependency).""" | |
| from sensorflow.rotr.scenes import generate_bank | |
| return generate_bank(n_scenarios=28, seed=7, model_version="stack-v1") | |
| def detections_v1(bank_v1): | |
| """Scenario -> violations for the seeded bank (pure, in memory).""" | |
| from sensorflow.rotr.rules import detect | |
| return {sc.scenario_id: detect(sc) for sc in bank_v1} | |