False negative error: ScopeMismatch must not be raised for Factories as fixtures used in fixtures with a higher scope #9235
Labels
topic: fixtures
anything involving fixtures directly or indirectly
Problem explanation
ScopeMismatch
must not be raised for Factories as fixtures used in fixtures with a higher scope. I am forced to setscope="module"
for my factories, but this is nonsense: factories always return a new value. In general, setting any scope for a factory use redundant and unnecessary: scope affects nothing for factories as fixtures. Please correct me if I am wrong.Expected behavior
Allow writing factories as fixtures without scope and use them in fixtures with any scope.
Sample failing code:
Sample working code:
The same as above, but set scope for the factory fixture:
Versions
Pytest: 6.2.5
Python: 3.9
OS: Lubuntu 20.04
The text was updated successfully, but these errors were encountered: