Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure PyCharm's Coverage checker to recognize .coveragerc?

Tags:

I have a .coveragerc file in the root of my project. It tells coverage.py to omit my project's migrations directories:

[run] omit = *migrations* 

When I run coverage.py at the command line, the config I put in .coveragerc is obeyed.

However, PyCharm does not recognize it. Is there a setting that I'm missing?

If it turns out there's no way for PyCharm to recognize .coveragerc, I'd be happy with even just a way to omit those directories.

like image 500
coffee-grinder Avatar asked Oct 22 '15 04:10

coffee-grinder


People also ask

How do you increase code coverage in Python?

Increase coverage by adding more tests The code coverage has increased to 78% on adding another test case. It can be increased further to 100% in a similar fashion.

What is Pragma no cover?

That exact # pragma: no cover is the hint that the part of code should be ignored by the tool -- see Excluding code from coverage .


2 Answers

You can make PyCharm use the .coveragerc by putting it into the working directory you run your tests from.

The feature request from https://youtrack.jetbrains.com/issue/PY-16945 was implemented and works in version 2018.1.

like image 145
Jorge Leitao Avatar answered Sep 25 '22 11:09

Jorge Leitao


There is a feature request for this at https://youtrack.jetbrains.com/issue/PY-16945

like image 33
sorin Avatar answered Sep 24 '22 11:09

sorin