Why does nosetests say –with-coverage is not an option?

I am using nosetests to automatically discover and run my unittests. I would also like to have it generate coverage reports.

When I run nosetests with the following command everything works just fine

nosetests .

I looked up online that to generate the coverage, nosetests has a command line argument --with-coverage. I also double checked that this command exists using nosetests --help. However, whenever I run the following command I get the following output

nosetests --with-coverage .
Usage: nosetests [options]

nosetests: error: no such option: --with-coverage

I double checked that the coverage plugin is installed by running

nosetests --plugins

coverage shows up in the list along with a bunch of other plugins.

I also know I have coverage installed because I can manually run the coverage data collection using something along the lines of:

coverage run test.py

Am I misusing the –with-coverage option? Or is there something else I am missing?

Thanks in advance.

Best answer

Your syntax is correct. It maybe an issue with your environment, double check your python environment and where your have nose and coverage installed. As a sanity check, you can quickly setup a new virtualenv, install nose, and run the command with the coverage option.