[TIP] recommended way to run nose from coverage

Ned Batchelder ned at nedbatchelder.com
Fri May 27 12:54:07 PDT 2016


"coverage run" is meant to be a replacement for "python".  So "python 
foo.py" can become "coverage run foo.py", and "python -m foo" can become 
"coverage run -m foo".  Coverage.py doesn't know how to run commands, 
though there is an open ticket requesting that feature.

If you know your command is actually a Python program, you can try:   
coverage run `which nosetests`

André has the right answer for nose, since it will run as a module.

--Ned.


On 5/27/16 8:38 AM, André Caron wrote:
> This is how I do it:
>
>     coverage run -m nose ...
>
> André
>
> On Fri, May 27, 2016 at 8:29 AM, Chris Withers <chris at simplistix.co.uk 
> <mailto:chris at simplistix.co.uk>> wrote:
>
>     On 06/01/2016 18:30, Ned Batchelder wrote:
>
>         FWIW, I strongly prefer using coverage to run nose rather than
>         the other
>         way around.  I guess that's to be expected :)  This may be an
>         effect of
>         the nose coverage plugin somehow.
>
>
>     How do you do this?
>
>     my naive:
>
>      coverage run nosetests
>
>     ...gives "No file to run: 'noestests"
>
>     Chris
>
>     _______________________________________________
>     testing-in-python mailing list
>     testing-in-python at lists.idyll.org
>     <mailto:testing-in-python at lists.idyll.org>
>     http://lists.idyll.org/listinfo/testing-in-python
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20160527/f968441d/attachment.htm>


More information about the testing-in-python mailing list