Code coverage does not work with PyDev

First, sorry for re-assigning. I found several posts on this topic, but none of the recommendations worked for me. The result is well known: PyDev always says "File has no statistics."

In a previous installation (Linux and Windows), I saw that this works as described on the PyDev page.

This is my setup:

  • Ubuntu 15.10
  • Eclipse Mars. 1
  • PyDev 4.4.0.201510052309
  • python 3.4
  • coverage 4.0.3 (located in / usr / local / lib / python 3.4 / dist-packages)

In Eclipse / PyDev, the Coverage view is displayed, the main folder of the program is selected, and the option "enable code coverage for new launches" is enabled. Each time I run the code (regardless of unit tests or normal run), the coverage window shows an empty table or, if the file is selected, the above message.

The path (starting with / home / username ...) does not contain spaces.

I tried to set the PyUnit level of detail to 9. Although the console has more output, the coverage statistics remain empty.

Is there anyone who has an idea? Have I missed anything in this scenario?

Thank you for your help.

Chris

EDIT: The path to the .coverage file is reported by the detailed output of the PyUnit console. This file exists and it looks like this (I just deleted the path here, but it was right):

! coverage.py: This is a private format, do not read it directly! {"lines": {"/home/.../....py": [5, 7, 8, 9, 12, 14, 15, 16, 17, 18, 19, 21, 22, 25, 26, 27, 29, 30, 31, 32, 33, 34] home / ... / .... py ": [5, 38, 7, 29, 9, 42, 11, 12, 13, 15, 17, 44, 19, 40, 21, 23, 25, 27, 10, 31], "/home/.../....py": [32, 33, 34, 35, 36, 5, 7 , 8, 9, 39, 12, 15, 23, 26, 27, 37, 30, 31]}}

+1
code-coverage pydev coverage.py
source share
1 answer

The problem was in the coverage version, which supposedly should be less than v4. As saaj wrote in his answer to this question , the installation was done with

 sudo pip install "coverage < 4.0.0" 

fixed the problem. So this is my setup:

  • Python 3.4
  • PyDev 4.4
  • coverage 3.7.1

and this combination works great.

UPDATE: I have now (January 2019) checked this again and can confirm that the current versions of the tools work perfectly together:

  • Python 3.5
  • PyDev 7.0.3
  • coverage 4.5.2

Thus, it is no longer necessary to name a specific version of the coverage as shown above.

+3
source share

All Articles