From f5165064eedf852898ff0418f40e404a9b1eda19 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 22 Jul 2018 09:41:03 -0300 Subject: [PATCH] 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. --- src/_pytest/fixtures.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index f384fa4c3..207bf27e4 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -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()