jeudi 30 avril 2015

how to omit imports using .coveragerc in coverage.py?

I am using nosetests --with-coverage to test and see code coverage of my unit tests. The class that I test has many external dependencies and I mock all of them in my unit test.

When I run nosetests --with-coverage, it shows a really long list of all the imports (including something I don't even know where it is being used).

I learned that I can use .coveragerc for configuration purposes but it seems like I cannot find a helpful instruction on the web.

My questions are.. 1) In which directory do I need to add .coveragerc? How do I specify the directories in .coveragerc? My tests are in a folder called "tests".. /project_folder /project_folder/tests

2)It is going to be a pretty long list if I were to add each in omit= ... What is the best way to only show the class that I am testing with the unittest in the coverage report?

It would be nice if I could get some beginner level code examples for .coveragerc. Thanks.

Aucun commentaire:

Enregistrer un commentaire