You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.rst
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,11 @@
1
1
Releases
2
2
========
3
3
4
+
UNRELEASED
5
+
----------
6
+
7
+
* `#524 <https://github.com/pytest-dev/pytest-mock/pull/524>`_: Added ``spy_return_iter`` to ``mocker.spy``, which contains a duplicate of the return value of the spied method if it is an ``Iterator``.
Copy file name to clipboardExpand all lines: docs/usage.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,7 @@ are available (like ``assert_called_once_with`` or ``call_count`` in the example
81
81
In addition, spy objects contain two extra attributes:
82
82
83
83
* ``spy_return``: contains the last returned value of the spied function.
84
+
* ``spy_return_iter``: contains a duplicate of the last returned value of the spied function if the value was an iterator. Uses `tee <https://docs.python.org/3/library/itertools.html#itertools.tee>`__) to duplicate the iterator.
84
85
* ``spy_return_list``: contains a list of all returned values of the spied function (new in ``3.13``).
85
86
* ``spy_exception``: contain the last exception value raised by the spied function/method when
86
87
it was last called, or ``None`` if no exception was raised.
0 commit comments