Download scripts/check_test_environment.py from Syncre/arabic-audio-reader-worker: direct link, hf CLI and curl.
- Browser
- Download file 714 Bytes
-
https://huggingface.co/spaces/Syncre/arabic-audio-reader-worker/resolve/main/scripts/check_test_environment.py
- Command line
-
hf download hf://spaces/Syncre/arabic-audio-reader-worker/scripts/check_test_environment.py
-
curl -L -o check_test_environment.py https://huggingface.co/spaces/Syncre/arabic-audio-reader-worker/resolve/main/scripts/check_test_environment.py
714 Bytes
| from __future__ import annotations | |
| import importlib.util | |
| import sys | |
| REQUIRED_MODULES = { | |
| "pytest": "pytest", | |
| "fastapi": "fastapi", | |
| "httpx": "httpx", | |
| "fitz": "PyMuPDF", | |
| } | |
| def missing_modules() -> list[str]: | |
| return [package for module, package in REQUIRED_MODULES.items() if importlib.util.find_spec(module) is None] | |
| def main() -> int: | |
| missing = missing_modules() | |
| if not missing: | |
| print("Test environment ready.") | |
| return 0 | |
| print("Test environment is missing: " + ", ".join(missing)) | |
| print("Install project test dependencies with:") | |
| print("python -m pip install -r requirements.txt") | |
| return 1 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |