Coverage.py warning: No data was collected. (no-data-collected)

I’m running into the following problem/message: Coverage.py warning: No data was collected. (no-data-collected)

When I’m in a virtual environment (locally) and execute the following line (in the project root), everything seems to work and all the reports (junit AND coverage xml/html) are generated:

python -m pytest --junitxml=test-reports/test-results.xml --cov=./ --cov-report=xml --cov-report=html

I have the exact same line in my .circleci/config.yml file wich outputs the following:

it doesn’t fail, but it doesn’t generate the .coverage file so it can’t generate the reports.

I must have something to do with the difference between the venv and circle, but i can’t seem the find out what. Has anyone experieced this before?

.circleci/config.yml

version: 2.1
orbs:
  codecov: codecov/codecov@1.0.4
jobs:
  build:
    docker:
    - image: circleci/python:3.7.3
    steps:
    - checkout
    - run:
        name: install dependencies
        command: |
          python3 -m venv venv
          . venv/bin/activate
          cd BandManager
          pip install -r requirements.txt
    - run:
        name: excute testrunner and coverage
        command: |
          . venv/bin/activate
          cd BandManager
          python -m pytest --junitxml=test-reports/test-results.xml --cov=./ --cov-report=xml --cov-report=html
    - codecov/upload:
        flags: backend

It looks like the CodeCov orb isn’t finding the test files. @thomasrockhu is this something you can assist with? :slight_smile:

Hmmm, I’m not quite sure what is happening here, but @Ewald91 would you be able to screenshot the Codecov output?

1 Like

Thanks for looking into this!

Here’s a screenshot of the Codecov output.

To me it looks like the orb does what it’s suppposed to do. There is just no coverage data.

Am i using the codecoverage correctly with Pytest when calling:
python -m pytest --junitxml=test-reports/test-results.xml --cov=./ --cov-report=xml --cov-report=html ?

1 Like