[TIP] Test Parameterization with unittest

Doug Philips dgou at mac.com
Tue May 12 08:00:10 PDT 2009


On or about Tuesday, May 12, 2009, at 07:12AM, Michael Foord indited:
>I'm also not wild about specifying a dictionary of parameters which then 
>'magically' become instance attributes. It would make me antsy writing 
>tests that use attributes which don't exist until they are stuck onto 
>the instance.

Yes, when you put it that way, I agree. Magical attributes <shudder>.

>I like the *mechanism* of TestWithScenarios though. I'd prefer to 
>specify a test method and have it called with arguments from the 
>scenario. I might update my metaclass recipe to do something like this. 
>Although it isn't suitable for going into unittest.py it is perfectly 
>usable.

Hmmm, how is that different (operationally) from funcargs?
http://codespeak.net/py/trunk/test/funcargs.html
http://bitbucket.org/hpk42/py-trunk/issue/2/next-generation-generative-tests

>As I don't have a personal need for *either* I think I should avoid 
>trying to push something into the standard library. It is a subject to 
>revisit as it seems like a gap in unittest.

Agreed on all those points, it seems premature to push something just yet.

-Doug



More information about the testing-in-python mailing list