forked from snandan/xml-diff
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexecute_update_readme.py
77 lines (51 loc) · 1.68 KB
/
execute_update_readme.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import re
def readmeUpdatePerformanceInfo():
_path_readme = './README.md'
_path_report = './tests/GeneralTests.CompareAll.txt'
_performance_str = """
[//]: # (insert_performance_start)
```
{insert}
```
[//]: # (insert_performance_end)
"""
_re_performance = """
\[//\]: # \(insert_performance_start\)
.*
\[//\]: # \(insert_performance_end\)
"""
with open(_path_readme, "r") as f:
_content = f.read()
_md_performance = re.findall(_re_performance, _content, re.M | re.S)[0]
with open(_path_report, 'r') as f:
_performance_unittest = f.read()
_content = _content.replace(_md_performance,
_performance_str.format(insert=_performance_unittest))
with open(_path_readme, "w") as f:
_content = f.write(_content)
def readmeUpdateCoverageInfo():
_path_readme = './README.md'
_path_report = './tests/GeneralTests.Coverage.txt'
_performance_str = """
[//]: # (insert_coverage_start)
```
{insert}
```
[//]: # (insert_coverage_end)
"""
_re_performance = """
\[//\]: # \(insert_coverage_start\)
.*
\[//\]: # \(insert_coverage_end\)
"""
with open(_path_readme, "r") as f:
_content = f.read()
_md_performance = re.findall(_re_performance, _content, re.M | re.S)[0]
with open(_path_report, 'r') as f:
_performance_unittest = f.read()
_content = _content.replace(_md_performance,
_performance_str.format(insert=_performance_unittest))
with open(_path_readme, "w") as f:
_content = f.write(_content)
readmeUpdatePerformanceInfo()
readmeUpdateCoverageInfo()