code-coverage

Making py.test, coverage and tox work together: __init__.py in tests folder?

Making py.test, coverage and tox work together: __init__.py in tests folder? Question: I’m having a weird problem with tox, py.test, coverage and pytest-cov: when py.test with the –cov option is launched from tox, it seems to require an __init__.py file in the tests folder which is not immediately obvious. While writing this post, I have …

Total answers: 2

How to exclude mock package from python coverage report using nosetests

How to exclude mock package from python coverage report using nosetests Question: I currently try to use the mock library to write some basic nose unittests in python. After finishing some basic example I now tried to use nosetests –with-coverage and now I have the mock package and the package I tried to ‘mock away’ …

Total answers: 3

Excluding abstractproperties from coverage reports

Excluding abstractproperties from coverage reports Question: I have an abstract base class along the lines of: class MyAbstractClass(object): __metaclass__ = ABCMeta @abstractproperty def myproperty(self): pass But when I run nosetests (which coverage) on my project, it complains that the property def line is untested. It can’t actually be tested (AFAIK) as instantiation of the abstract …

Total answers: 3

"No source for code" message in Coverage.py

"No source for code" message in Coverage.py Question: I ran a build last night, successfully. I got up this morning and ran another without changing any configuration or modifying any source code. Now my build is failing with the message “No source for code” when running my nosetests with coverage. NoSource: No source for code: …

Total answers: 10

coverage.py: exclude files

coverage.py: exclude files Question: How do I exclude entire files from coverage.py reports? According to the documentation you can exclude code by matching lines. I want to exclude entire files, so that the reports don’t include 3rd party libraries. Am I missing something? Can it be done? Asked By: flybywire || Source Answers: You can …

Total answers: 5