[TIP] new test parametrization / deprecating "yield"

Michael Foord fuzzyman at voidspace.org.uk
Thu May 14 12:55:09 PDT 2009

holger krekel wrote:
> Hi all,
> thanks to Michael, Doug, Titus and everybody else's comments
> and interest on generative tests i'd eventually cleaned up 
> the docs and wrote up a blog post about py.test's new 
> parametrized tests here:
>     http://tetamap.wordpress.com/2009/05/13/parametrizing
> It discusses three test parametrization approaches, including
> Rob's testscenarios.  Concludes with: yielding tests is now 
> officially deprecated in favour of using the pytest_generate_tests 
> hook which allows to implement all kinds of custom parametrizing approaches. 

I like the decorator syntax. I've updated my recipe to use it. :-)


I prefer Konrad's mechanism to a metaclass and will consider the matter 


> To be honest, yield-based tests have always been a bit of a
> headache conceptually and implementation wise. So i am quite
> happy to have arrived at a solution that seems to substitute
> and improve on them as well as on other solutions.  The hook 
> is also designed to work well together with distributing tests 
> to multiple machines but i leave discussing that to another 
> time as it requires conceptually discussing py.test's model of 
> distributing test runs. 
> best & thanks again for the good discussions here, 
> holger


More information about the testing-in-python mailing list