fix test sample s1.mp4 missing

This commit is contained in:
ykcheungab
2026-09-20 11:46:03 +08:00
parent 153f51df11
commit 0e903792bd
4 changed files with 18 additions and 7 deletions
+3 -3
View File
@@ -193,11 +193,11 @@ print(json.dumps({
# Default runtime-verification inputs. Overridable by CLI flags or environment. # Default runtime-verification inputs. Overridable by CLI flags or environment.
DEFAULT_RUNTIME_CONFIG = os.getenv("ORISYS_VERIFY_CONFIG", "box") DEFAULT_RUNTIME_CONFIG = os.getenv("ORISYS_VERIFY_CONFIG", "box")
# Clips tracked in the repository, smallest first. # Clips tracked in the repository. ``data/sample/s1.mp4`` is the sanctioned
# verification input; the larger 720p clip is deliberately not listed, so a
# missing s1.mp4 fails loudly instead of silently verifying against it.
DEFAULT_VIDEO_CANDIDATES = ( DEFAULT_VIDEO_CANDIDATES = (
Path("data") / "sample" / "s1.mp4", Path("data") / "sample" / "s1.mp4",
Path("data") / "sample" / "s1_720p.mp4",
Path("tests") / "idle_1min.mp4",
) )
Binary file not shown.
+12 -2
View File
@@ -1,4 +1,5 @@
import json import json
import os
import shutil import shutil
import sys import sys
from contextlib import ExitStack from contextlib import ExitStack
@@ -21,9 +22,17 @@ def _resource_path(*parts: str) -> Path | None:
"""Resolve a package resource to a filesystem path for wheel-safe loaders.""" """Resolve a package resource to a filesystem path for wheel-safe loaders."""
try: try:
resource = files("orisys").joinpath(*parts) resource = files("orisys").joinpath(*parts)
return _RESOURCE_STACK.enter_context(as_file(resource)) resolved = _RESOURCE_STACK.enter_context(as_file(resource))
except Exception: except Exception:
return None return None
# ``as_file`` is not contractually a ``pathlib.Path``: a Nuitka-compiled
# build hands back its own ``nuitka_resource_reader_files``, which is
# path-like but has no ``.resolve()``. Normalise here so every caller can
# treat the result as a Path.
try:
return Path(os.fspath(resolved))
except TypeError:
return None
def _unique_paths(paths) -> list[Path]: def _unique_paths(paths) -> list[Path]:
@@ -31,9 +40,10 @@ def _unique_paths(paths) -> list[Path]:
unique: list[Path] = [] unique: list[Path] = []
seen: set[str] = set() seen: set[str] = set()
for path in paths: for path in paths:
path = Path(path) if not isinstance(path, Path) else path
try: try:
key = str(path.resolve()).casefold() key = str(path.resolve()).casefold()
except OSError: # pragma: no cover - defensive: unresolvable path except (OSError, ValueError): # pragma: no cover - defensive
key = str(path).casefold() key = str(path).casefold()
if key in seen: if key in seen:
continue continue
+3 -2
View File
@@ -46,11 +46,12 @@ from orisys import Sensor
from orisys import configs as orisys_configs from orisys import configs as orisys_configs
from orisys.backend_availability import check_cupy_available, check_opencl_available from orisys.backend_availability import check_cupy_available, check_opencl_available
# Video clips that are tracked in git, in preference order. # Video clips that are tracked in git, in preference order. The 720p clip is
# deliberately not a fallback: tests should run the sanctioned sample or skip,
# never silently verify against a different resolution.
DEFAULT_VIDEO_CANDIDATES = ( DEFAULT_VIDEO_CANDIDATES = (
Path("tests") / "idle_1min.mp4", Path("tests") / "idle_1min.mp4",
Path("data") / "sample" / "s1.mp4", Path("data") / "sample" / "s1.mp4",
Path("data") / "sample" / "s1_720p.mp4",
) )