provide error fixture applied to the same func

provide error fixture applied to the same func

provide error fixture applied to the same func
This commit is contained in:
ApaDoctor 2017-10-05 11:45:35 +03:00
parent 9b51fc646c
commit cfd16d0dac
2 changed files with 5 additions and 0 deletions

View File

@ -827,6 +827,10 @@ class FixtureFunctionMarker:
if isclass(function):
raise ValueError(
"class fixtures not supported (may be in the future)")
if getattr(function, "_pytestfixturefunction", False):
raise ValueError(
"fixture is being applied more than once to the same function")
function._pytestfixturefunction = self
return function

1
changelog/2334.feature Normal file
View File

@ -0,0 +1 @@
Now when @pytest.fixture is being applied to the same function ValueError is raised.