-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-tests.py
45 lines (33 loc) · 1.04 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
"""Run tests and replace latest report"""
import os
import sys
from pathlib import Path
REPORTS = {
"latest": "1.5.0",
"v1.4.0": "1.4.0",
"v1.3.0": "1.3.0",
"v1.2.0": "1.2.0",
}
def run_test(comver):
print("Running with toml-test version:", comver)
outfile = f"reports/with_toml-test_{comver}.md"
cmd = f"python -m toml_bench --iter 5000 --comver {REPORTS[comver]} --report {outfile}"
os.system(cmd)
def render_readme():
print("Rendering README file")
report = []
rptfile = Path("reports/with_toml-test_latest.md")
outfile = Path("./README.md")
rawfile = Path("./README.raw.md")
with rptfile.open("r") as f:
for line in f:
if line.startswith("#"):
line = f"#{line}"
report.append(line)
readme = rawfile.read_text().replace("{{latest-report}}", "".join(report))
outfile.write_text(readme)
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "run":
for key in REPORTS:
run_test(key)
render_readme()