[TIP] Meta-test methods...
jnoller at gmail.com
Wed Apr 22 12:10:28 PDT 2009
On Wed, Apr 22, 2009 at 3:03 PM, Douglas Philips <dgou at mac.com> wrote:
> I noticed that py.test (and maybe nose, I haven't looked yet) has a
> way for a "test method" to return test messages.
> The py.test mechanism uses some groddy checks to see if a test method
> is really a generator.
> Granted a generator does not make sense as a test method...
> This is a facility I need to introduce to our slightly customized
> version of test unit.
> At first I was smitten by the "coolness" of using a generator and the
> automatic detection thereof.
> Then I remembered: import this's "Explicit is better than implicit."
> And so I thought, well, rather than grunging around in various
> implementation details like py.test does, to determine if a method is
> a generator, I should use a decorator.
> With a decorator why I can even write a meta-test method that returns
> (Horrors!) a list! Or a set, or a tuple.
> The only thing I haven't decided upon, and hence this note to the
> list, is what to name the decorator.
> Has anyone else done this? Have a good name to suggest?
Yes, nose supports test generators. They're the balls.
More information about the testing-in-python