[TIP] decorators in testing [was: cleanUp for unittest]
michael at quuxo.com
Sat Apr 4 04:52:24 PDT 2009
On Fri, 2009-04-03 at 21:03 +0100, Michael Foord wrote:
> Totally new subject - could you elaborate on what is meant by test
> decorators, what they do and how they do it (usage rather than
JUnit 4 defines a set of method decorators for defining fixture set up
and tear-down methods as well as actual test methods, rather relying on
magic names. This is actually rather nifty and something I'd like to see
in the Python testing universe.
In Python, a test class might look like:
def newFoo(self): ...
def handleFrobnostication(self): ...
def destroyFoo(self): ...
The advantages include being able to not have to worry about remembering
to call super's setUp and tearDown, not even having to inherit from the
TestCase class, being able to call your methods whatever you want, and
being able to programmatically locate test-related methods, rather than
relying on magic name voodoo.
Does anyone have an implementation of this for Python? If not I might
put one together.
Michael Gratton <michael at quuxo.com>
Quuxo Software <http://web.quuxo.com/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090404/ee444db1/attachment.pgp
More information about the testing-in-python