Skip to content

Commit 0493f7d

Browse files
committed
Merge pull request #8 from pytest-dev/mock-behaviour-fix
simplify and fix the mock fixture
2 parents 4e55167 + 931ce18 commit 0493f7d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pytest_mock.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,12 @@ def mocker():
7878
result.stopall()
7979

8080

81-
@pytest.yield_fixture
82-
def mock():
81+
@pytest.fixture
82+
def mock(mocker):
8383
"""
8484
Same as "mocker", but kept only for backward compatibility.
8585
"""
8686
import warnings
8787
warnings.warn('"mock" fixture has been deprecated, use "mocker" instead',
8888
DeprecationWarning)
89-
for m in mocker():
90-
yield m
89+
return mocker

0 commit comments

Comments
 (0)