[TIP] Ideology

Douglas Philips dgou at mac.com
Fri Apr 24 11:29:26 PDT 2009


> In case people are interested, here are four alternatives I came up  
> with
> for conditionally defining tests:
>
> http://github.com/ctb/pygr/tree/runtest_single_x/trial/
>
> tests.py -- basic broken example
>
> tests-no-append.py -- what we do now, not compatible with some other
> 	test selection code that we want to add
>
> tests-skip.py -- fails in unittest, but can yield informative message
> 	to those not using nose/not having necessary resources
>
> tests-skip-by-nodef.py -- succeeds, not pretty
>
> test-skip-hack.py -- my proposed actual hack, which only requires
> 	modifying the unittest test runner in a minor way.

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).

--Doug




More information about the testing-in-python mailing list