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)
| 50 | |
| 51 | # TODO: Reduce code duplication here and in `conftest.py` |
| 52 | def 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""" |
| 62 | 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: |
| 63 | |
| 64 | git fetch --depth=1 https://github.com/Breakthrough/PySceneDetect.git refs/heads/resources:refs/remotes/origin/resources |
| 65 | git checkout refs/remotes/origin/resources -- tests/resources/ |
| 66 | git reset |
| 67 | """ |
| 68 | ) |
| 69 | return abs_path |
| 70 | |
| 71 | |
| 72 | @dataclass |
no outgoing calls
no test coverage detected