diff --git a/backend/tests/test_rc_runtime_observability.py b/backend/tests/test_rc_runtime_observability.py index 21d6c8b8..a9bd01a1 100644 --- a/backend/tests/test_rc_runtime_observability.py +++ b/backend/tests/test_rc_runtime_observability.py @@ -28,6 +28,7 @@ def test_runtime_report_is_read_only_by_default_and_requires_confirmation() -> N dockerfile = (ROOT / "deploy" / "unraid" / "Dockerfile.all-in-one").read_text(encoding="utf-8") assert '"mode": "read_only"' in source + assert 'IMPORT_ROOT = ROOT if (ROOT / "app").is_dir() else BACKEND' in source assert "if args.reconcile and args.confirm != RECONCILE_CONFIRMATION" in source assert "RuntimeReconciliationService.reconcile(db)" in source assert "COPY scripts/runtime_state_report.py /app/scripts/runtime_state_report.py" in dockerfile diff --git a/scripts/runtime_state_report.py b/scripts/runtime_state_report.py index ff079c53..b2b250a2 100644 --- a/scripts/runtime_state_report.py +++ b/scripts/runtime_state_report.py @@ -11,7 +11,8 @@ from pathlib import Path ROOT = Path(__file__).resolve().parents[1] BACKEND = ROOT / "backend" -sys.path.insert(0, str(BACKEND)) +IMPORT_ROOT = ROOT if (ROOT / "app").is_dir() else BACKEND +sys.path.insert(0, str(IMPORT_ROOT)) from app.db.session import SessionLocal # noqa: E402 from app.models import AnalysisRun, Job # noqa: E402