Some possible improvements in fixtures module · Issue #11234 · pytest-dev/pytest (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@sadra-barikbin

Description

@sadra-barikbin

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