Pycharm code coverage integration - How to display line by line coverage

  • 8
  • 6

Hi

I am using Pycharm 2.0.1 with python 2.6.6 and py.test. When I run my tests “with Coverage” the coverage information is updated

and displayed behind each file and folder in the project view.

However, I cannot see which lines are covered within a source code file. A Google search revealed,

that there should be a red / green indicator on the left side of the editor, which is not there in my setup (using default color scheme).

Question: How can I turn on the display of the coverage information in the source code editor.

Thanks in advance

Hi,

You can set up line coverage colors for your scheme in Settings | Editor | Colors and fonts | General

There choose 'Full line coverage' setting for covered lines and 'Uncovered line' for uncovered ones.

To set coverage color for editor lines - use Backgroud color setting, for gutter use Foreground.


I tried the following:

copied the default color theme and assigned some vivid colors for the cover and uncover line settings. I tried Foreground,

Background as well as Error marker, after tesing each of them seperatly I tried all at once. Between the tests I ran the tests- with coverage.

Not a single line in the editor was marked as cover or uncovered.


Do you happen to have a .pth file pointing to your project? That caused the same problem for me: http://youtrack.jetbrains.net/issue/PY-5238


yes, I will try it without the pth file and post the results here.

Thanks, for pointing me into this direction.


I removed the .pth link and reconfigured the SourceRoot, so the module can still be found by the tests, when I run them from within pycharm.

However, nothing changed. Coverage is displayed in the Project Toolbox, but it is not displayed in the editor.

Also Generate Coverage Report aborts with exit code -1.


This is also not working for me. PyCharm 2.0.1 on Mac OS X 10.6.I am using the bundled coverage.  Coverage % is shown next to the filename next to the filename but not in the editor. I have tried to change the format (In Editor > Color & Font > General) but does not produce any effect.

Thanks,

Hernan


I am using PyCharm 2.0.2 on Mac OS X 10.7.3 with the bundled coverage tool - following these steps I am not able to see line-by-line code coverage in the editor either.


Code coverage works fine with the PyCharm 2.5beta. Just installed it and it worked, without any special settings.