-
Notifications
You must be signed in to change notification settings - Fork 4
/
nox_report.py
executable file
·35 lines (28 loc) · 1.09 KB
/
nox_report.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
#!/usr/bin/python3
import json
def parse_report(report_file: str, title: str) -> None:
with open(report_file, 'r') as fh:
report = json.load(fh)
print(f'## {title}\n')
for session in report['sessions']:
# looks weird, but is literally how Nox creates a "friendly name"
# for a session
name = session['signatures'][0] \
if session['signatures'] else session['name']
result = session['result']
if result == 'success':
mark = 'heavy_check_mark'
elif result == 'skipped':
mark = 'large_blue_circle'
else:
mark = 'heavy_multiplication_x'
print(f'* {name}: {result} :{mark}:')
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--report', required=True,
help='the Nox JSON report to parse')
parser.add_argument('-t', '--title', default='Nox',
help='title for the generated summary section')
args = parser.parse_args()
parse_report(args.report, args.title)