fix test sample s1.mp4 missing
This commit is contained in:
+12
-2
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
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."""
|
||||
try:
|
||||
resource = files("orisys").joinpath(*parts)
|
||||
return _RESOURCE_STACK.enter_context(as_file(resource))
|
||||
resolved = _RESOURCE_STACK.enter_context(as_file(resource))
|
||||
except Exception:
|
||||
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]:
|
||||
@@ -31,9 +40,10 @@ def _unique_paths(paths) -> list[Path]:
|
||||
unique: list[Path] = []
|
||||
seen: set[str] = set()
|
||||
for path in paths:
|
||||
path = Path(path) if not isinstance(path, Path) else path
|
||||
try:
|
||||
key = str(path.resolve()).casefold()
|
||||
except OSError: # pragma: no cover - defensive: unresolvable path
|
||||
except (OSError, ValueError): # pragma: no cover - defensive
|
||||
key = str(path).casefold()
|
||||
if key in seen:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user