[TIP] Test Parameterization with unittest

Michael Foord fuzzyman at voidspace.org.uk
Mon May 11 13:10:35 PDT 2009


Douglas Philips wrote:
> On 2009 May 11, at 12:33 PM, Michael Foord wrote:
>   
>> Currently trying to write tests for test discovery.
>>     
>
> What I did to get my current itch scratched was have a new method  
> prefix: "make_tests" - the unit test framework runs that and expects  
> it to return a sequence of TestCase instances to be run. It was the  
> simplest change I could make to get creating dynamic tests. You can  
> check the archives for details.
>   

I can't find it in the archives I'm afraid - looong thread spread across 
two months archives.

When are make_tests prefixed methods called and by whom? (Are they 
static method or instance methods?)

One of the problems with unittest is that a test could be run by 
TestRunner.run, TestCase.run or TestSuite.run. I understand that 
creating test methods at class creation time may be too early for some 
use cases, but it does support all the ways that tests can be run.

Michael

> -Doug
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog





More information about the testing-in-python mailing list