-
Notifications
You must be signed in to change notification settings - Fork 39
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
[Major] Improve the fixture union engine to support hybrid param+fixture mode #170
Comments
After sleeping on this I think the right order would better be:
|
Another way to say the above is "before I thought that fixture unions were the core and parametrize would reuse this, but we have to revert this pattern: a fixture union is "just" a parametrized fixture with only Another thing we'll need to do in this refactoring, as discussed in #158, is to support parametrized This plan becomes clearer and clearer, I'm optimistic for 2021 ! But as always, devil will be in the tiny details: custom ids, custom marks, custom fixture scopes, etc. |
The latest developments about test ids uniformization, as well as #146 and pytest-dev/pytest#8155, made me realize that maybe the fixture union engine could be extended to natively support hybrid param+fixture unions.
If this works this would have two benefits:
@parametrize
would not have to generate a global union fixture for the parameters as of today, immediately solving when @parametrize finds a fixture_ref in its argvalues, the parameter is not anymore accessible throughrequest.getfixturevalue
#146@parametrize
would not have to generate one fixture per group of parameters, so in particular@parametrize_with_cases
would probably be much more efficient (far less fixtures generated, only when a case requires a fixture)However... it will probably be hard to do. A few things to do:
UnionFixtureAlternative.to_list_of_fixture_names
will have to only return only the fixtures and not the parameterspython-pytest-cases/pytest_cases/plugin.py
Line 295 in aeb72ef
FixtureClosureNode._build_closure
can understandpython-pytest-cases/pytest_cases/plugin.py
Line 246 in aeb72ef
modify the calls reactor behaviour when it receives a Union Param
python-pytest-cases/pytest_cases/plugin.py
Line 760 in aeb72ef
python-pytest-cases/pytest_cases/plugin.py
Line 834 in aeb72ef
finally checking how the ids in all the tests will evolve and how/if we should adapt idstyle
Not an easy ride but might be worth the shot in 2021
The text was updated successfully, but these errors were encountered: