-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use multiple yield statements as an alternative for parametrization #1595
Comments
I'm strictly opposed, that model is broken See #16 for the same issue in a different context |
I read #16, thanks. I'm not sure what you mean by "that model is broken", but looking at a UX point of view parametrizing fixtures using |
it is technically impossible to manage setupstate in a consistent way if you merge parameterization and value creation because you need to paramerize at collect time |
Yep, that's what I figured, we have to obtain all items during the collection phase, and fixtures parametrized that way won't be executed until the first test that uses it executes, long past the collection phase. 😞 Well, let's close this then! 😁 |
If you want a silly question: why is it that we can't add a test after setup time ? in case tests are distributed perhaps ? |
@jpic in the current model of pytest, there is a collect phase, where all tests are collected,and afterwards the number of tests no longer changes |
After we merge #1586, I think we can discuss using
yield
as an alternative for fixture parametrization.As mentioned at the end of
yield_fixture.html
:I really like this idea, it seems to fix really nicely on how I've parametrized fixtures in the past. Consider:
If we can use multiple
yield
statements, this becomes:I find the above much easier to understand, and it is perfectly backward compatible since multiple
yield
s are currently disallowed.Having said that I'm not sure how easy it would be to actually implement this, since parametrization currently occurs during the collection phase, while fixtures yielding values would only be noticed during the
setup
phase.The text was updated successfully, but these errors were encountered: