try coverage
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
pytest:
|
pytest:
|
||||||
image: python:3.10-alpine
|
image: python:3.10-alpine
|
||||||
only:
|
|
||||||
- main
|
|
||||||
script:
|
script:
|
||||||
- sh tests/start_tests_gitlab.sh
|
- sh tests/start_tests_gitlab.sh
|
||||||
- sed -i "s#<source>/builds/DasMoorhuhn/autopicture-v3/src</source>#<source>${CI_PROJECT_DIR}</source>#g" coverage.xml
|
- sed -i "s#<source>/builds/DasMoorhuhn/autopicture-v3/src</source>#<source>${CI_PROJECT_DIR}</source>#g" coverage.xml
|
||||||
|
coverage: '/Code coverage: \d+(?:\.\d+)?/'
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "$CI_JOB_NAME"
|
name: "$CI_JOB_NAME"
|
||||||
reports:
|
reports:
|
||||||
|
|||||||
14
tests/get_coverage_percent.py
Normal file
14
tests/get_coverage_percent.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
with open(file="coverage.xml") as file:
|
||||||
|
file_content = file.readlines()
|
||||||
|
|
||||||
|
line_rate = None
|
||||||
|
|
||||||
|
for line in file_content:
|
||||||
|
try:
|
||||||
|
line = line.strip().split("<")[1].split(">")[0].split(" ")
|
||||||
|
if line[0] == "package":
|
||||||
|
line_rate = "Code coverage: " + str(int(round(float(line[2].split("=\"")[1].split("\"")[0])*100, 0))) + "%"
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
print(line_rate)
|
||||||
@@ -5,4 +5,5 @@ sh tests/start_tests.sh
|
|||||||
|
|
||||||
cp tests/coverage/coverage.xml ./coverage.xml
|
cp tests/coverage/coverage.xml ./coverage.xml
|
||||||
cp tests/coverage/report.xml ./report.xml
|
cp tests/coverage/report.xml ./report.xml
|
||||||
# python3.10 tests/edit_source.py
|
|
||||||
|
python3.10 tests/get_coverage_percent.py
|
||||||
|
|||||||
Reference in New Issue
Block a user