1. Ned Batchelder
  2. coverage.py
  3. Issues
Issue #95 resolved

run subcommand should take a module name

Anonymous created an issue

A la python -m <mod> switch, it'd be helpful to pass a the name of a module to cover, instead of just a file.

The use case here is integration with unittest's test discovery. As of 2.7 can do python -m unittest discover and it will find your tests. There's no way AFAICT to simulate this correctly - trying to pass '/usr/lib/python2.7/unittest/init.py' as run's <pyfile> argument messes up import paths.

Currently, I wrote a little stub that just calls unittest's main(), but figuring this out how to do this was slightly annoying.

Comments (4)

  1. Log in to comment