5

I've written tests for my python code and want to check how much % is covered with tests, so I decided to use python coverage. But I have a problem launching it. I launch my tests with this bash command:

export PYTHONPATH=. && python files/test/tests.py

My python program is in "files" directory, and tests are in "test", so I can't launch it another way. Using

export PYTHONPATH=. && python coverage files/test/tests.py

raises Error. How to correctly use coverage in my situation ?

oz123
29.1k30 gold badges133 silver badges196 bronze badges
asked Dec 10, 2013 at 10:59

2 Answers 2

3

The correct way to do this is to use an appropriate coverage plugin for the unit testing framework/runner you are using:

Here are some combinations:

There are probably other tools and combinations you can use. But these two are probably the most common (no reference).

answered Dec 10, 2013 at 11:04
Sign up to request clarification or add additional context in comments.

Comments

3
coverage run files/test/tests.py
answered Apr 9, 2015 at 17:24

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.