Skip to content

Commit f516506

Browse files
committed
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.
1 parent c9a0881 commit f516506

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/_pytest/fixtures.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1027,13 +1027,7 @@ def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=N
10271027
.. deprecated:: 3.0
10281028
Use :py:func:`pytest.fixture` directly instead.
10291029
"""
1030-
if callable(scope) and params is None and not autouse:
1031-
# direct decoration
1032-
return FixtureFunctionMarker("function", params, autouse, ids=ids, name=name)(
1033-
scope
1034-
)
1035-
else:
1036-
return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
1030+
return fixture(scope=scope, params=params, autouse=autouse, ids=ids, name=name)
10371031

10381032

10391033
defaultfuncargprefixmarker = fixture()

0 commit comments

Comments
 (0)