[TIP] dynamically retrieving fixtures which depend on generated parameters from the comand-line

Elizabeth Lin elin at splunk.com
Tue May 14 15:14:30 PDT 2013


Here's the simplified example code:
https://gist.github.com/elizabethlin/7754f0324b8f7b1c7388

this gets generates the following tests:
test_example.py:31: TestExample.test_one[std] FAILED
test_example.py:35: TestExample.test_two[std] FAILED
test_example.py:39: TestExample.test_three[std] FAILED
test_example.py:31: TestExample.test_one[virt] FAILED
test_example.py:35: TestExample.test_two[virt] FAILED


 when really I want
test_example.py:31: TestExample.test_one[std] FAILED
test_example.py:35: TestExample.test_two[std] FAILED
test_example.py:39: TestExample.test_three[std] FAILED
test_example.py:31: TestExample.test_one[virt-typeA] FAILED
test_example.py:35: TestExample.test_two[virt-typeA] FAILED
" [virt-typeB]
" [virt-typeB]

Can someone help me out?  I imagine that pytest_generate_tests gets called at an earlier step, before the fixtures are executed, and at that time, it can't detect that we need the parametrization for generated fix to happen.  There's probably other reasons this won't work, but I'm having trouble decifering the pytest code, and the flow of it.

Thanks,
Liz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130514/3bd30f1d/attachment.htm>


More information about the testing-in-python mailing list