-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun_tests.py
executable file
·55 lines (42 loc) · 1.31 KB
/
run_tests.py
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
#!/usr/bin/env python3
"""
Run all available tests.
Runs the following commands:
{}
"""
import argparse
from env_setup import execute_command_list
__commands_to_run = ["poetry run pytest"]
__doc__ = __doc__.format("\n ".join(__commands_to_run))
def run_tests(do_setup=False, self_check=False, verbose=True):
"""Run code checks."""
if self_check:
__commands_to_run.insert(0, "python self_check.py")
if do_setup:
__commands_to_run.insert(0, "python env_setup.py")
execute_command_list(__commands_to_run, verbose=verbose)
def main():
"""Self check with cli args."""
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, description=__doc__
)
parser.add_argument(
"--setup",
action="store_true",
help='run "./env_setup.py" before running self checks',
)
parser.add_argument(
"--check",
action="store_true",
help='run "./self_check.py" before running self checks',
)
parser.add_argument(
"-q",
"--quiet",
action="store_true",
help="do not show each command before it is executed",
)
args = parser.parse_args()
run_tests(do_setup=args.setup, self_check=args.check, verbose=not args.quiet)
if __name__ == "__main__":
main()