[Baypiggies] test method decorators
bsergean at gmail.com
Fri Jun 15 15:45:35 CEST 2007
One other decorator idea, close to the platform one, would be a module specific.
RIght now in my test I do it in my main runner script, trying to
import module specific tests, and removing them from the test modules
if the import fail.
Could we have a TestCase decorator level to do that (that might not
work since the module are imported in the first line of the test case
Is there a better way to do that ?
Would it be a TestRunner decorator ?
defaultTestModules = [os.path.splitext(i) for i in glob('*_test.py')]
# Remove tests that require non-installed dependency.
On 6/15/07, Kelly Yancey <kelly at nttmcl.com> wrote:
> 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
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
More information about the Baypiggies