run subcommand should take a module name · Issue #95 · nedbat/coveragepy (original) (raw)
Originally reported by Anonymous
A la python -m 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 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.