[Baypiggies] test method decorators

Kelly Yancey kelly at nttmcl.com
Fri Jun 15 14:37:19 CEST 2007

  A couple of people asked me after the meeting to post my test method
decorators for implementing TODO and platform-specific test annotations
using the unittest module (they should work for nose too).  I just put
them up on my blog at:

  I whipped them up during the meeting, so they are a little rough
around the edges and only lightly tested, but I think they express the
idea that unittest can do composition of extensions using function
wrappers.  Python's decorator syntax makes wrapping the test methods
easy on the eyes and intuitive.  The only thing I am currently aware of
that cannot be done using decorators is implementing alternate loggers
(e.g. to database or to XML).  The unittest module has some support for
replacing loggers, and Collin alluded to an XML logger that I link to in
my blog, but composition of loggers, as Collin mentioned in his talk, is
distinctly non-trivial.


Kelly Yancey

More information about the Baypiggies mailing list