[TIP] Ideology

Doug Hellmann doug.hellmann at gmail.com
Fri Apr 24 12:29:59 PDT 2009

On Apr 24, 2009, at 2:40 PM, C. Titus Brown wrote:

> On Fri, Apr 24, 2009 at 02:29:26PM -0400, Douglas Philips wrote:
> ->
> -> I'm not sure what this has to do with conditionally defining  
> tests, it
> -> seems to be about extending unittest to handle a new kind of result
> -> (Skip). Maybe I'm confused. When we added our extra test results
> -> mechanisms we started with a copy of unittest because it wasn't
> -> factored in a way that lets subclassing work cleanly for this  
> kind of
> -> thing, and we knew that no one in Python core was interested in  
> making
> -> a change to the old 2.4.x tree. (Hopefully we'll be moving up to  
> 2.5,
> -> but we won't be close to the cutting edge anytime soon, such are  
> the
> -> fortunes of corporate life).
> We are after conditionally *executing* tests, I guess.  SkipTest is  
> one
> of several ways to do that; tests-no-append and tests-skip-by-nodef  
> are
> other ways (one of which is conditionally defining, one conditionally
> executing).

The SkipTest exception is an interesting solution.  It seems like it  
would work well for tests where fixtures aren't expensive, but I've  
found that explicitly tagging tests to be run or not works better for  
me.  The tag can be applied conditionally via a decorator when the  
test is imported, so you still get the dynamic behavior based on  
available resources.


More information about the testing-in-python mailing list