[Python-Dev] unittest2 plus class and module level fixtures in unittest

Mark Roddy markroddy at gmail.com
Mon Mar 8 05:04:15 CET 2010

 On Sun, Mar 7, 2010 at 8:11 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Le Mon, 08 Mar 2010 00:51:02 +0000,
> Michael Foord <fuzzyman at voidspace.org.uk> a écrit :
>> In other news, class and module fixtures (setUpClass /
>> tearDownClass / setUpModule / tearDownModule) are now implemented in
>> unittest (in trunk
>> - not yet merged to py3k). These features are tested but I'm sure
>> there are some lurking bugs or oddities, so please try them out. I
>> have not yet added documentation for them; I'll pull it out from this
>> email as a starting point.
>> I'd rather this thread didn't become *another* debate on the merit of
>> these features, but perhaps that is too much to hope for.
> Just for the record, could you sum up the reasons why you/we decided on
> this route rather than e.g. adding a test-resources-like facility?
> (I'm not saying I disagree, it's just that I didn't remember a decision
> had already been made on this point)
> Thanks for all your work on this!
> cheers
> Antoine.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/markroddy%40gmail.com

There were some lengthy threads on python-ideas
and python-dev (http://mail.python.org/pipermail/python-dev/2010-February/097521.html).

I'm sure Michael has a set of factors that are most important to him
for the decision (which I don't blame him for not wanting to get into,
the two previous threads were contentious), but for me personally I
don't view class/module setup and test-resources as necessarily
competing options.  For the simplest use case ( create some expensive
connection and/or object which is essentially stateless and won't need
to be torn down), I personally find a test-resources solution to
require an unnecessary amount of work to implement.  After exploring
it a bit in the course of those discussions I hope that test-resources
(or something similar, maybe something like junit rules which was also
brought up) makes it into the stdlib at some point as some of the more
complicated integration/scenario tests I support would be made much
simpler with such functionality.


More information about the Python-Dev mailing list