-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_pytest.py
More file actions
34 lines (27 loc) · 848 Bytes
/
run_pytest.py
File metadata and controls
34 lines (27 loc) · 848 Bytes
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
"""Run pytest."""
import sys
from pathlib import Path
from subprocess import run
def run_pytest() -> int:
"""Run pytest."""
tests_folder = Path(__file__).resolve().parent
repo_folder = tests_folder.parent
results_folder = tests_folder / "results"
return run(
args=(
"pytest",
tests_folder,
"--numprocesses=auto",
"--durations=0",
"--verbosity=2",
f"--junitxml={results_folder}/results.xml",
f"--cov={repo_folder}",
f"--cov-config={tests_folder}/.coveragerc",
f"--cov-report=html:{results_folder}/htmlcov",
"--cov-report=term",
f"--cov-report=xml:{results_folder}/coverage.xml",
),
check=False,
).returncode
if __name__ == "__main__":
sys.exit(run_pytest())