Quote

"Between stimulus and response there is a space. In that space is our power to choose our response.
In our response lies our growth and freedom"


“The only way to discover the limits of the possible is to go beyond them into the impossible.”


Tuesday 3 January 2017

Python Code Coverage

Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not.

Its a simple tool to measure code coverage but is slightly buggy and it can be tricky if version issues are not taken care of. 

Coverage 4.3.1 installed from here with Pyhton 2.7 constantly gave 'file has no statistics' error. Seems like if file path has spaces then it gives this error. However for me I had no spaces in the file path or in the PyDev project. After some time I figured out that the problem was with the coverage module version. For some strange reasons/issue it works with coverage version less than 4.0.0.

So this is what solved the problem for me: python -m pip install "coverage < 4.0.0"




After this it worked like a charm. You can even drag and drop the folders which you want to analyze for code coverage. Isn't it cool??


No comments:

Post a Comment