Skip to content

Commit 50f99e5

Browse files
committed
Record exceptions as side effects for spies
1 parent b3e0ad5 commit 50f99e5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/pytest_mock/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def wrapper(*args, **kwargs):
116116
try:
117117
r = method(*args, **kwargs)
118118
except Exception as e:
119-
result.return_value = e
119+
result.side_effect = e
120120
raise
121121
else:
122122
result.return_value = r

tests/test_pytest_mock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def bar(self, arg):
259259
assert str(exc_info.value) == excepted_message
260260

261261
foo.bar.assert_called_once_with(arg=10)
262-
assert spy.return_value == exc_info.value
262+
assert spy.side_effect == exc_info.value
263263

264264

265265
@skip_pypy

0 commit comments

Comments
 (0)