Add a tests run script and more requirement files (#2480)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-r requirements.txt
|
||||
-r requirements-dev.txt
|
||||
-r docs/requirements.txt
|
||||
-r setup/requirements.txt
|
||||
-r tests/requirements.txt
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run novelWriter Tests."""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""Parse command line options and run the commands."""
|
||||
parser = argparse.ArgumentParser(usage="run_tests.py [--flags]")
|
||||
parser.add_argument("-o", action="store_true", help="Run off screen")
|
||||
parser.add_argument("-r", action="store_true", help="Generate reports")
|
||||
parser.add_argument("-t", action="store_true", help="Generate terminal report")
|
||||
parser.add_argument("-m", help="Test modules")
|
||||
parser.add_argument("-k", help="Test filters")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
env = os.environ.copy()
|
||||
cmd = [sys.executable, "-m", "pytest", "-vv"]
|
||||
|
||||
if args.o:
|
||||
env["QT_QPA_PLATFORM"] = "offscreen"
|
||||
if args.r or args.t:
|
||||
cmd += ["--cov=novelwriter"]
|
||||
if args.r:
|
||||
cmd += ["--cov-report=xml", "--cov-report=html"]
|
||||
if args.t:
|
||||
cmd += ["--cov-report=term"]
|
||||
if args.m:
|
||||
cmd += ["-m", args.m]
|
||||
if args.k:
|
||||
cmd += ["-k", args.k]
|
||||
|
||||
print("Calling:", " ".join(cmd))
|
||||
subprocess.call(cmd, env=env)
|
||||
@@ -0,0 +1,2 @@
|
||||
setuptools>=77.0.3
|
||||
twine
|
||||
Reference in New Issue
Block a user