[TIP] testing unittest2 plugin branch Was: How to get coverage.py and unittest2 working together?

Michael Foord fuzzyman at voidspace.org.uk
Wed Jul 28 16:15:02 PDT 2010

On 28/07/2010 22:41, Jorge Vargas wrote:
> On Wed, Jul 28, 2010 at 5:29 PM, Michael Foord
> <fuzzyman at voidspace.org.uk>  wrote:
>> On 28/07/2010 21:49, Jorge Vargas wrote:
>>>> On 22/07/2010 21:02, Tim Hatch wrote:
>>>> For what it's worth I'm now prototyping the extension mechanism for
>>>> unittest/unittest2. Anyone who wants to follow along can look at the
>>>> "plugins" branch of the repository at http://hg.python.org/unittest2
>> Thanks - as I'm prototyping this it isn't tested yet - as you can tell. This
>> is fixed though. It is nearly in a condition where I can write it up for
>> this mailing list and python-dev. I expect it to still change, but I've been
>> discussing it with Jason Pellerin who reports that the system is basically
>> fine for "nose2" and he is porting a couple of the nose plugins to it. I'm
>> very interested in feedback.
> I have been looking at the code and it does seems good enough. I like
> how easy writing a plugin looks.
> I'm working this on my day job and at this point I can't live without
> coverage reports (I'm up to 30%!), so I can commit to test this daily,
> also several others plugins that I may need, perhaps I can even write
> patches :D although I don't know this codebase at all....

I've pushed a few fixes for the coverage module in particular, so you 
should update (and report any *new* problems).

> for example the pdb plugin is currently not working as it's putting
> the stop in inside unittest2, it is also doing funny things when
> enabled together with checker :)

It seems to work fine for me - even with the checker enabled. It is 
possible that one of my recent changes fixed it again :-o Could you try 
it again?

You may want to set the following in the config file if you are using 
the checker as the checker tends to produce a lot of fails!

errors-only = True

Hmm... although if the error or the failure exception is raised inside 
unittest2 code - rather than directly in your code - the debugger plugin 
will drop you into the frame where the exception was raised, and not 
necessarily inside your own code. This is something that could be 
improved. In the meantime you can just type u <enter> to go up frames 
until you return to your code.

> another minor thing is that I think report-html = False as you will
> get normal "to the shell reports" just like nose default.
The coverage plugins needs more command line options to configure it. 
I'll change the default in the example unittest.cfg to report-html = 
False though.

> anyway it does looks really nice and I'm going to live on the edge
> here so fell free to ping me :)
Hehe, cool but unwise. ;-)

(Thanks for the feedback.)



READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.

More information about the testing-in-python mailing list