I'm trying to retrieve the coverage of my unittests with Py.Test. The problem is that I get also coverage information about other python files which I don't care about.
Here is an example of my file structure. In this case I want to test: car.py, wheel.py and steer.py
python2.7/site-packages/
- car.py
- wheel.py
- steer.py
- coverage.py (from pypi.python.org)
- yaml (the python yaml library, from pypi.python.org)
- pytest-2.5.2-py2.7.egg (the python py.test library)
- and many more
python2.7/site-packages/test/
Now I use Py.Test to execute the test:
python -m pytest --cov python2.7/site-packages/ python2.7/site-packages/test/test_car.py
But this results in the coverage of all the python files in site-packages (kinda obvious).
python -m pytest --cov python2.7/site-packages/car.py python2.7/site-packages/test/test_car.py
This results in only the coverage of the car.py and not all the files I want.
How can I use Py.Test to only to measure coverage of specific files?
(I also tried:
python -m pytest --cov python2.7/site-packages/car.py,python2.7/site-packages/wheel.py python2.7/site-packages/test/test_car.py
But Py.Test doesn't know how to parse and use this argument.
)