MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / get_absolute_path

Function get_absolute_path

tests/test_detectors.py:52–69  ·  view source on GitHub ↗

Returns the absolute path to a (relative) path of a file that should exist within the tests/ directory. Throws FileNotFoundError if the file could not be found.

(relative_path: str)

Source from the content-addressed store, hash-verified

50
51# TODO: Reduce code duplication here and in `conftest.py`
52def get_absolute_path(relative_path: str) -> str:
53 """Returns the absolute path to a (relative) path of a file that
54 should exist within the tests/ directory.
55
56 Throws FileNotFoundError if the file could not be found.
57 """
58 abs_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), relative_path)
59 if not os.path.exists(abs_path):
60 raise FileNotFoundError(
61 f"""
62Test video file ({relative_path}) must be present to run test case. This file can be obtained by running the following commands from the root of the repository:
63
64git fetch --depth=1 https://github.com/Breakthrough/PySceneDetect.git refs/heads/resources:refs/remotes/origin/resources
65git checkout refs/remotes/origin/resources -- tests/resources/
66git reset
67"""
68 )
69 return abs_path
70
71
72@dataclass

Calls

no outgoing calls

Tested by

no test coverage detected