Repository navigation
Expand file tree
/
Copy pathrun_tests.py
More file actions
64 lines (56 loc) · 1.59 KB
/
Copy pathrun_tests.py
File metadata and controls
64 lines (56 loc) · 1.59 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""Research-only local quality and test entry point; all Python tools use UV."""
import argparse
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parent
def commands(mode):
quality = [
[
"uv",
"run",
"python",
"-m",
"black",
"--check",
"src/project",
"tests",
"run_tests.py",
],
[
"uv",
"run",
"python",
"-m",
"isort",
"--check-only",
"src/project",
"tests",
"run_tests.py",
],
["uv", "run", "python", "-m", "mypy", "src/project/dqt"],
]
suites = {
"all": [["uv", "run", "pytest", "tests/", "-v"]],
"unit": [["uv", "run", "pytest", "tests/unit/", "-v"]],
"integration": [["uv", "run", "pytest", "tests/integration/", "-v"]],
"e2e": [["uv", "run", "pytest", "tests/e2e/", "-v", "--run-e2e"]],
"quality": quality,
}
suites["ci"] = quality + suites["all"]
return suites[mode]
def main(argv=None):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"mode",
choices=("all", "unit", "integration", "e2e", "quality", "ci"),
default="all",
nargs="?",
)
args = parser.parse_args(argv)
for command in commands(args.mode):
result = subprocess.run(command, cwd=ROOT)
if result.returncode:
return result.returncode
return 0
if __name__ == "__main__":
raise SystemExit(main())