Paul Winkler wrote:
> I have a need to have a batch of tests that do some expensive
> setup once for the whole batch.  AFAICT this is what layers are for.


> One question though... Why do the examples in
> zope/testing/testrunner-ex/ have setUp() and tearDown()
> as classmethods?

Because the test runner expects layers to be objects with setUp() and
tearDown() "methods". So, if you want to pass a class without
instantiating it first, you need to make these class methods so that
they don't expect 'self' as the first argument.

> Is it just an implementation detail of those tests, or something
> I should be aware of when creating my own layers?

Just pass in any object that has 'setUp' and 'tearDown' callables as
attributes :).


Zope3-users mailing list

Reply via email to