forked from vantage6/vantage6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutest.py
More file actions
105 lines (87 loc) · 3.52 KB
/
Copy pathutest.py
File metadata and controls
105 lines (87 loc) · 3.52 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python3
import argparse
import logging
import sys
import types
from pathlib import Path
from vantage6.common.utest import find_tests, run_tests
# Suppress all logging output
logging.getLogger().setLevel(logging.CRITICAL)
for logger_name in logging.root.manager.loggerDict:
logging.getLogger(logger_name).setLevel(logging.CRITICAL)
# The uwsgi Python package is a C extension that is only available when running
# inside a uwsgi process.
# Required here because the blobstream resource imports uwsgi, and it is built
# in the Dockerfile and not in the requirements.txt.
sys.modules["uwsgi"] = types.SimpleNamespace()
def run():
parser = argparse.ArgumentParser(description="Run vantage6 test suites")
parser.add_argument("--common", action="store_true", help="Run common tests")
parser.add_argument("--cli", action="store_true", help="Run CLI tests")
parser.add_argument(
"--algorithm-store", action="store_true", help="Run algorithm store tests"
)
parser.add_argument(
"--algorithm-tools", action="store_true", help="Run algorithm tools tests"
)
parser.add_argument("--hq", action="store_true", help="Run HQ tests")
parser.add_argument("--node", action="store_true", help="Run node tests")
parser.add_argument("--all", action="store_true", help="Run all test suites")
args = parser.parse_args()
# If no specific tests are selected, run all by default
if not any(
[
args.common,
args.cli,
args.algorithm_store,
args.algorithm_tools,
args.hq,
args.node,
args.all,
]
):
args.all = True
success = True
# run common tests
if args.common or args.all:
common_test_path = Path(__file__).parent / "vantage6-common" / "tests"
common_test_suites = find_tests(str(common_test_path))
success_common = run_tests(common_test_suites)
success = success and success_common
# run algorithm store tests
if args.algorithm_store or args.all:
algorithm_store_test_suites = find_tests(
str(Path(__file__).parent / "vantage6-algorithm-store")
)
success = success and run_tests(algorithm_store_test_suites)
# run algorithm tools tests
if args.algorithm_tools or args.all:
algorithm_tools_test_suites = find_tests(
str(Path(__file__).parent / "vantage6-algorithm-tools")
)
success = success and run_tests(algorithm_tools_test_suites)
# run algorithm tools tests
if args.algorithm_tools or args.all:
algorithm_tools_test_suites = find_tests(
str(Path(__file__).parent / "vantage6-algorithm-tools")
)
success_algorithm_tools = run_tests(algorithm_tools_test_suites)
success = success and success_algorithm_tools
# run HQ tests
if args.hq or args.all:
hq_test_suites = find_tests(str(Path(__file__).parent / "vantage6-hq"))
success_hq = run_tests(hq_test_suites)
success = success and success_hq
# run node tests
if args.node or args.all:
node_test_suites = find_tests(str(Path(__file__).parent / "vantage6-node"))
success_node = run_tests(node_test_suites)
success = success and success_node
# run CLI tests
if args.cli or args.all:
cli_test_suites = find_tests(str(Path(__file__).parent / "vantage6"))
success_cli = run_tests(cli_test_suites)
success = success and success_cli
sys.exit(not success)
if __name__ == "__main__":
run()