Skip to content
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

Some possible improvements in fixtures module #11234

Open
sadra-barikbin opened this issue Jul 20, 2023 · 0 comments
Open

Some possible improvements in fixtures module #11234

sadra-barikbin opened this issue Jul 20, 2023 · 0 comments
Labels
type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature type: refactoring internal improvements to the code

Comments

@sadra-barikbin
Copy link
Contributor

sadra-barikbin commented Jul 20, 2023

Here are a list of possible improvements in pytest fixtures, initially introduced in #10771 .

Improvement Corresponding PR
Remove funcargs attribute from Callspec to unify parameters of the test item, as funcargs are transformed into pseudo-fixtures. #11220
Remove fixtures.py::add_funcarg_pseudo_fixture_def and care for transforming funcargs to pseudo fixturedefs right in MetaFunc.parametrize. #11220
Make FixtureArgKey to represent fixture param by its value rather than its index if possible, as does FixtureDef::cache_key . #11271
When parametrizing with multiple parametersets (or multiple tuples of params), index of parameters in a parameter set is determined by their index in the existing values of the parameter, not by the index of their parameter set in the parameter set list. This results in better identifying dependencies of tests, thus better reordering. #11257
Creating FixtureArgKey for representing fixture dependencies. #11231
Taking nonparametrized tests into consideration for reordering as well. Beforehand, only parametrized tests were considered, by retrieving their fixture dependecies. #11236
Remove fixtures.py::FuncFixtureInfo::prune_dependecy_tree and move its responsibility to very FixtureManager::getfixtureclosure. I note that populating arg2fixturedefs is done only once. #11243
Considering used shadowed fixture dependencies for reordering as well. This was done by changing fixturemanager::getfixtureclosure algo from BFS to DFS.
Pruning dependency tree is done only if we have a metafunc.parametrize call within module-specific or class-specific pytest_generate_tests hooks. #11243
Fix a few typos, or tiny bugs and do a few small improvements #11277, #11284
@nicoddemus nicoddemus added type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature type: refactoring internal improvements to the code labels Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature type: refactoring internal improvements to the code
Projects
None yet
Development

No branches or pull requests

2 participants