[TIP] How to get coverage.py and unittest2 working together?

Jorge Vargas jorge.vargas at gmail.com
Thu Jul 22 13:01:00 PDT 2010


Hello Ned,

On Thu, Jul 22, 2010 at 3:49 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> "coverage run xxx yyy zzz" should work if  "python xxx yyy zzz" would work.
>  How do you invoke unit2 at the command line?
>
Ahh I see.

I'm just calling the "unit2" script that is generated by distribute. I
though coverage will also pick up python scripts from path, but it
seems it only wants .py files.

Therefore this seems to be working

coverage run `which unit2` discover


> --Ned.
>
> On 7/22/2010 3:09 PM, Jorge Vargas wrote:
>>
>> Hello,
>>
>> I'm new here and I hope this is the right list for my question, if
>> it's not please let me know.
>>
>> I recently inherited a complex untested codebase and I'm starting by
>> building a robust test framework around it.
>>
>> I'm used to have nose as my test suite/runner/etc. However I want to
>> give unittest2 a try therefore my question is how we can get the two
>> working together? I'm used to nose running my coverage reports for me.
>>
>> In theory something like
>>
>> coverage run unit2 discover
>>
>> should work but it doesn't as coverage expects a .py file to execute.
>>
>> In other words which should be the equivalent of nosetests --with-coverage
>>
>> Thanks in advance.
>>
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python
>>
>>
>



More information about the testing-in-python mailing list