[TIP] setup_method not called for generative tests

holger krekel holger at merlinux.eu
Fri Feb 25 08:35:16 PST 2011


On Fri, Feb 25, 2011 at 16:49 +0100, Pere Martir wrote:
> I found that setup_method and teardown_method are not called for the tests
> generated by pytest_generate_tests(). Therefore I have to manually call them
> in each test method. I also found a post which supported this observation:
> 
> http://www.mail-archive.com/py-dev@codespeak.net/msg00143.html
> 
> Is there any reason that this behavior is by design or it's a bug ?

The link does not (or should not) apply to pytest_generate_tests, actually.
But your observation is correct, mixing pytest_generate_tests and setup_method
does not work. I guess it didn't pop up yet because pytest_generate_tests works 
with function arguments and they are usually not mixed with setup_method.
I'd be grateful if you file a bug at
https://bitbucket.org/hpk42/pytest/issues?status=new&status=open

thanks,
holger



More information about the testing-in-python mailing list