Chris Withers wrote:
It would appear that Philipp's article is somewhat misleading in that
layers can't be new style classes...
def setUp(self): pass
def tearDown(self): pass
..results in the following when used as a layer:
AttributeError: type object 'object' has no attribute 'setUp'
Is this a bug in Philipp's article or in the testrunner?
In Philipp's article.
Note that test layers don't have to be classes. Classes
with class methods just happen to be a (seductively) convenient
implementation. For example, ZCMLLayer defined in zope.app.testing.functional
is not a class, in the sense that Layer instances are not classes.
A layer is simply an object that has __module__, __name__, and __bases__
attributes and that has setUp and tearDown methods. That's it. You
can achieve that any way you want. I regret the use of the __bases__
attribute. It would have been better if I had left it up to layer
implementations to call base layers, rather than having the test runner call
them automatically. It was a bad automation tradeoff.
Jim Fulton mailto:[EMAIL PROTECTED] Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
Zope3-dev mailing list