[TIP] unittest2 plugins

jason pellerin jpellerin at gmail.com
Mon Jul 26 07:52:03 PDT 2010


On Mon, Jul 26, 2010 at 9:58 AM, jason pellerin <jpellerin at gmail.com> wrote:
> On Sat, Jul 24, 2010 at 5:39 AM, Michael Foord
> <fuzzyman at voidspace.org.uk> wrote:
>> On 24/07/2010 09:02, meme dough wrote:
>>>
>>> Hi,
>>>
>>> I see the email about unittest2 plugins.  I had a play with plugin
>>> mechanism.
>>>
>>>
>>
>> This is *very* much an experimental work in progress. When it is a bit more
>> complete I will send an email to python-dev and this list describing the
>> mechanism and solicit feedback on it.
>>
>> For those who just want to play now it is in the "plugins" branch of the
>> mercurial repo at:
>>
>>    http://hg.python.org/unittest2
>
> This is quite encouraging! I had a look at the branch this weekend,
> and I can see pretty clearly how to implement most of nose's builtin
> plugins.

Spoke a bit too soon. :) This morning as my first real experiment, I
tried to implement nose's attribute selector plugin, which lets you
assign arbitrary attributes to tests and then use commandline switches
like, eg:

-a !slow
-a tag=green,red

to filter the tests to run. This turns out to be pretty hard to do
with the unittest2 plugin api. The hook points for loading tests make
it easy to add additional tests or totally replace the list of tests
or test names, but there's no hook for filtering the lists that the
loader comes up with (or at least I didn't see one). A hook like that
would be a useful addition, if in fact there isn't one there that I've
missed.

JP



More information about the testing-in-python mailing list