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)
| 57 | |
| 58 | # TODO: Reduce code duplication here and in `conftest.py` |
| 59 | def get_absolute_path(relative_path: str) -> str: |
| 60 | """Returns the absolute path to a (relative) path of a file that |
| 61 | should exist within the tests/ directory. |
| 62 | |
| 63 | Throws FileNotFoundError if the file could not be found. |
| 64 | """ |
| 65 | abs_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), relative_path) |
| 66 | if not os.path.exists(abs_path): |
| 67 | raise FileNotFoundError( |
| 68 | f""" |
| 69 | Test 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: |
| 70 | |
| 71 | git fetch --depth=1 https://github.com/Breakthrough/PySceneDetect.git refs/heads/resources:refs/remotes/origin/resources |
| 72 | git checkout refs/remotes/origin/resources -- tests/resources/ |
| 73 | git reset |
| 74 | """ |
| 75 | ) |
| 76 | return abs_path |
| 77 | |
| 78 | |
| 79 | @dataclass |
no outgoing calls
no test coverage detected