-
Notifications
You must be signed in to change notification settings - Fork 27
/
dump_requirements_coverage.py
executable file
·54 lines (43 loc) · 1.37 KB
/
dump_requirements_coverage.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
#!/usr/bin/env python3
"""Generate coverage results for external requirements."""
import argparse
import logging
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import requirements
LOGGER = logging.getLogger(__name__)
def get_args() -> argparse.Namespace:
"""Get command line arguments."""
parser = argparse.ArgumentParser(description=__doc__.split("\n", maxsplit=1)[0])
parser.add_argument(
"-a",
"--artifacts-base-dir",
required=True,
type=helpers.check_dir_arg,
help="Path to a directory with testing artifacts",
)
parser.add_argument(
"-m",
"--requirements-mapping",
required=True,
help="JSON file with requirements mapping",
)
parser.add_argument(
"-o",
"--output-file",
required=True,
help="File where to save coverage results",
)
return parser.parse_args()
def main() -> None:
logging.basicConfig(
format="%(name)s:%(levelname)s:%(message)s",
level=logging.INFO,
)
args = get_args()
executed_req = requirements.collect_executed_req(base_dir=args.artifacts_base_dir)
report = requirements.get_mapped_req(
mapping=args.requirements_mapping, executed_req=executed_req
)
helpers.write_json(out_file=args.output_file, content=report)
if __name__ == "__main__":
main()