I'm using py.test
with coverage
. I was having problems with using pytest-cov
with my tests; when I ran py.test --cov=my_module --coverage-report=html .
, the function definitions in my module would be reported as missing, even though they should be executed when importing the module in the tests. This problem is mentioned in the FAQ.
Then this question led me to try just running coverage
rather than using pytest-cov
, like so:
coverage run --source my_module py.test .
Now I'm getting this error (I've shown only the most recent calls in the traceback):
[long traceback]
File "[…]/python3.3/site-packages/py/test.py", line 4, in <module>
sys.exit(pytest.main())
SystemExit: 0
During handling of the above exception, another exception occurred:
[long traceback]
File "[…]/python3.3/site-packages/coverage/collector.py", line 294, in stop
assert self._collectors[-1] is self
AssertionError
Has anyone else run into this? How can I get coverage
to work properly with py.test
?