Make yield_fixture just call fixture to do its work

Since fixture and yield_fixture are identical, they should call
the same code; as it was, the code inside them was already starting
to deviate.
This commit is contained in:
Bruno Oliveira 2018-07-22 09:41:03 -03:00
parent c9a0881309
commit f5165064ee
1 changed files with 1 additions and 7 deletions

View File

@ -1027,13 +1027,7 @@ def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=N
.. deprecated:: 3.0
Use :py:func:`pytest.fixture` directly instead.
"""
if callable(scope) and params is None and not autouse:
# direct decoration
return FixtureFunctionMarker("function", params, autouse, ids=ids, name=name)(
scope
)
else:
return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
return fixture(scope=scope, params=params, autouse=autouse, ids=ids, name=name)
defaultfuncargprefixmarker = fixture()