SonarQube scan shows 0 coverage on new code

I have these line sof code to run tests and generate a coverage report as part of gitlab pipeline:

  python -m pytest --durations=0 ./src/unittest -m build-tests --junitxml="junit-test-result-build.xml" --source=./src/main  -v --cov-report xml --cov=./src/main
  coverage lcov

The results in SonarQube for the overall project shows coverage fine. However, I’ve recently created a new branch and added some new functionality that is covered by unit tests. However, SonarQube shows 0% code coverage for the new code. Is there something wrong with the way I’m generating the report or is the issue somewhere else?

Hey there.

SonarQube only reads coverage reports – it’s not involved in producing them. Have you checked the coverage report to make sure it actually reports coverage on the new functionality?