Hello evryone. Im just strated imersion in this technology. can you please check and correct my script. at the moment my coverege.xml not translated to my service. its still 0.0%
sonar-scanner
-Dsonar.projectKey=backend-python
-Dsonar.sourses.inclusions=src
-Dsonar.test.inclusions=src/tests/test_*.py
-Dsonar.python.coverage.reportPaths=coverage.xml -Dsonar.host.url=https://
-Dsonar.login=sqp_
also I have sonar-project.properties file in repo
sonar.projectKey=backend-python
sonar.qualitygate.wait=true
sonar.python.coverage.reportPaths=coverage.xml
sonar.language=py
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.tests=src/tests
sonar.sources.inclusions=src
sonar.test.inclusions=src/tests/
INFO: SonarScanner 4.8.0.2856
I saw some error like âcoverage.jacaco not definedâ so I fix it vie adding new line point to properties âsonar.coverage.jacoco.xmlReportPaths=src/tests/*.xmlâ
and my coverage still not uploaded in the project statistic
It sure looks like the coverage report is being read correctly.
INFO: Python test coverage
INFO: Parsing report â/home/yevhen/python/polygon/polygon-backend-python/src/tests/coverage.xmlâ
INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=269ms
If you manually check the coverage.xml, is it reporting the coverage you expect (more than 0) on the files you expect? Feel free to share it here as well.
This looks like a test execution report rather than a coverage report. It shows the tests and how long they took to complete, but not coverage information.
I can point to the documentation on Python Test Coverage â but the help we can offer is limited. SonarQube just reads the report, it isnât involved in producing them.
'''
run in terminal
$coverage run -m pytest #run pytest under coverage data colecting
$coverage xml #create coverage.xml by coverage library
for collect covverage stat
run in terminal localy:
sonar-scanner
-Dsonar.projectKey= #keyname to my project
-Dsonar.host.url=https:// #link to our host
-Dsonar.login= #keyvalue to my project
- for create statistic remote
'''
sonar.projectKey=polygon-backend-python #keyname to my project
sonar.python.coverage.reportPaths=coverage.xml #path to coverage.xml
sonar.language=py #lenguage params
sonar.sourceEncoding=UTF-8 #encoding params
sonar.qualitygate.wait=true
sonar.sources=src #path to scanning repos
My solution seems like that code. but I steel have Unittest - . looking for resolving this problem