[Python-Dev] setUpClass and setUpModule in unittest

Ben Finney ben+python at benfinney.id.au
Fri Feb 12 21:51:36 CET 2010

Michael Foord <fuzzyman at voidspace.org.uk> writes:

> The advantage of setUpClass and setUpModule is that they allow you to
> have shared fixtures shared between tests, essential for certain kinds
> of testing. […]

Yes, this would be very useful for non-unit tests.

> My *hope* is that we provide a general solution, possibly based on all
> or part of Test Resources, with an easy mechanism for the setUpClass
> and setUpModule but also solves the more general case of sharing
> fixtures between tests.

+1 for having these in a more general “testing API”, with the ‘unittest’
API a special case that does *not* share fixtures between tests.

 \       “Following fashion and the status quo is easy. Thinking about |
  `\        your users' lives and creating something practical is much |
_o__)                                harder.” —Ryan Singer, 2008-07-09 |
Ben Finney

More information about the Python-Dev mailing list