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())