File size: 714 Bytes
2e1a095
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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())