3

When running pytest with python -m pytest --cov=. --cov-report html:coverage

After the coverage report is generated my tests show up in the code coverage report as being 100% covered as shown below

codecov

I've attempted to move tests into its own folder, but still yields the same results

The actual unit tests should not show up in the coverage report and are skewing my coverage amount. It should only show coverage for the actual program.

1

1 Answer 1

4

As mentioned in this SO answer, creating a .coveragerc and adding

[run]
omit = 
    */test*

solves this issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.