Class scoped fixture is called multiple times with mutable values and parameterisation #7175
Labels
status: help wanted
developers would like help from experts on this topic
topic: fixtures
anything involving fixtures directly or indirectly
topic: parametrize
related to @pytest.mark.parametrize
pip list
from the virtual environment you are usingWhen setting up test parameterisation using a combination of
pytest_generate_test
hooks and fixture decorators, along withpytest.mark.parameterize
decorators I'm seeing inconsistent behaviour with the fixtures which havescope='class'
. In the application context these fixtures load large tables of data which takes quite a long time.When an immutable object is passed as the fixture parameter - the fixtures behave as expected, however when mutable object, like a list is passed, the class fixture gets called repeatedly. The workaround identified in #896 did not seem to make a difference so I have opened a new issue.
If this is expected behaviour or a known bug I would like to add a warning to the docs to make this clear.
Possibly Related
#3678, #896
LSB Release
PIP Freeze >>
Minimum Reproducible Example
Output of Test
The text was updated successfully, but these errors were encountered: