python 2.7 - nosetests unable to import coverage with virtualenv -
i've installed nose
, coverage
virtual env, doesn't work
(venv) ../my_cookbook$ nosetests --with-coverage nose.plugins.cover: error: coverage not available: unable import coverage module
i wondered if escaping venv somehow, tried , worked!
(venv) ../my_cookbook$ ./venv/bin/nosetests --with-coverage
then wanted see if path how messed up.
(venv) ../my_cookbook$ nosetests /home/peter/projects/my_cookbook/venv/bin/nosetests (venv) ../my_cookbook$ coverage /home/peter/projects/my_cookbook/venv/bin/coverage
so going on here? somehow nosetests command escaping virtualenv don't know how.
unfortunately, don't have explanation why nose plugin not picking coverage, but, executing tests through coverage
should preferred opposed using test runner plugins (nose coverage plugin in case). quoting ned batchelder (the author of coverage):
using plugin means depending on plugin's behavior being correct , understandable. in name of being helpful, plugins have own logic may have been best idea when written, test runner and/or coverage.py may have changed in meantime. plugins tend not well-maintained other components. if can avoid them, have 1 less thing think about.
in other words, run:
$ coverage run -m nose
and coverage report:
$ coverage report
Comments
Post a Comment