Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-mock for openSUSE:Factory checked in at 2025-09-30 17:48:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-mock (Old) and /work/SRC/openSUSE:Factory/.python-pytest-mock.new.11973 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-mock" Tue Sep 30 17:48:29 2025 rev:30 rq:1308060 version:3.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-mock/python-pytest-mock.changes 2025-09-11 14:39:37.516519113 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-mock.new.11973/python-pytest-mock.changes 2025-09-30 17:49:36.375507063 +0200 @@ -1,0 +2,8 @@ +Mon Sep 29 20:31:05 UTC 2025 - Dirk Müller <[email protected]> + +- update to 3.15.1: + * #529: Fixed itertools._tee object has no attribute error -- + now duplicate_iterators=True must be passed to mocker.spy to + duplicate iterators. + +------------------------------------------------------------------- Old: ---- pytest_mock-3.15.0.tar.gz New: ---- pytest_mock-3.15.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-mock.spec ++++++ --- /var/tmp/diff_new_pack.nOipiW/_old 2025-09-30 17:49:37.119538398 +0200 +++ /var/tmp/diff_new_pack.nOipiW/_new 2025-09-30 17:49:37.123538567 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-pytest-mock -Version: 3.15.0 +Version: 3.15.1 Release: 0 Summary: Thin-wrapper around the mock package for easier use with pytest License: MIT ++++++ pytest_mock-3.15.0.tar.gz -> pytest_mock-3.15.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/.github/workflows/deploy.yml new/pytest_mock-3.15.1/.github/workflows/deploy.yml --- old/pytest_mock-3.15.0/.github/workflows/deploy.yml 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/.github/workflows/deploy.yml 2025-09-16 18:36:26.000000000 +0200 @@ -58,7 +58,7 @@ git push origin v${{ github.event.inputs.version }} - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.10" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/.github/workflows/test.yml new/pytest_mock-3.15.1/.github/workflows/test.yml --- old/pytest_mock-3.15.0/.github/workflows/test.yml 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/.github/workflows/test.yml 2025-09-16 18:36:26.000000000 +0200 @@ -61,7 +61,7 @@ path: dist - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python }} allow-prereleases: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/.pre-commit-config.yaml new/pytest_mock-3.15.1/.pre-commit-config.yaml --- old/pytest_mock-3.15.0/.pre-commit-config.yaml 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/.pre-commit-config.yaml 2025-09-16 18:36:26.000000000 +0200 @@ -9,13 +9,13 @@ language: python additional_dependencies: [pygments, restructuredtext_lint] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.11 + rev: v0.13.0 hooks: - id: ruff args: ["--fix"] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.17.1 + rev: v1.18.1 hooks: - id: mypy files: ^(src|tests) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/CHANGELOG.rst new/pytest_mock-3.15.1/CHANGELOG.rst --- old/pytest_mock-3.15.0/CHANGELOG.rst 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/CHANGELOG.rst 2025-09-16 18:36:26.000000000 +0200 @@ -1,6 +1,13 @@ Releases ======== +3.15.1 +------ + +*2025-09-16* + +* `#529 <https://github.com/pytest-dev/pytest-mock/issues/529>`_: Fixed ``itertools._tee object has no attribute error`` -- now ``duplicate_iterators=True`` must be passed to ``mocker.spy`` to duplicate iterators. + 3.15.0 ------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/PKG-INFO new/pytest_mock-3.15.1/PKG-INFO --- old/pytest_mock-3.15.0/PKG-INFO 2025-09-04 22:57:13.738569000 +0200 +++ new/pytest_mock-3.15.1/PKG-INFO 2025-09-16 18:36:30.309248700 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: pytest-mock -Version: 3.15.0 +Version: 3.15.1 Summary: Thin-wrapper around the mock package for easier use with pytest Author-email: Bruno Oliveira <[email protected]> License: MIT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/docs/usage.rst new/pytest_mock-3.15.1/docs/usage.rst --- old/pytest_mock-3.15.0/docs/usage.rst 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/docs/usage.rst 2025-09-16 18:36:26.000000000 +0200 @@ -78,10 +78,10 @@ The object returned by ``mocker.spy`` is a ``MagicMock`` object, so all standard checking functions are available (like ``assert_called_once_with`` or ``call_count`` in the examples above). -In addition, spy objects contain two extra attributes: +In addition, spy objects contain four extra attributes: * ``spy_return``: contains the last returned value of the spied function. -* ``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. +* ``spy_return_iter``: contains a duplicate of the last returned value of the spied function if the value was an iterator and spy was created using ``.spy(..., duplicate_iterators=True)``. Uses `tee <https://docs.python.org/3/library/itertools.html#itertools.tee>`__) to duplicate the iterator. * ``spy_return_list``: contains a list of all returned values of the spied function (new in ``3.13``). * ``spy_exception``: contain the last exception value raised by the spied function/method when it was last called, or ``None`` if no exception was raised. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/scripts/gen-release-notes.py new/pytest_mock-3.15.1/scripts/gen-release-notes.py --- old/pytest_mock-3.15.0/scripts/gen-release-notes.py 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/scripts/gen-release-notes.py 2025-09-16 18:36:26.000000000 +0200 @@ -18,7 +18,7 @@ capture = False for line in rst_text.splitlines(): # Only start capturing after the latest release section. - if line.startswith("-------"): + if line.startswith("----"): capture = not capture if not capture: # We only need to capture the latest release, so stop. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/src/pytest_mock/_util.py new/pytest_mock-3.15.1/src/pytest_mock/_util.py --- old/pytest_mock-3.15.0/src/pytest_mock/_util.py 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/src/pytest_mock/_util.py 2025-09-16 18:36:26.000000000 +0200 @@ -15,7 +15,7 @@ config.getini("mock_use_standalone_module") ) if use_standalone_module: - from unittest import mock + import mock _mock_module = mock else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/src/pytest_mock/_version.py new/pytest_mock-3.15.1/src/pytest_mock/_version.py --- old/pytest_mock-3.15.0/src/pytest_mock/_version.py 2025-09-04 22:57:13.000000000 +0200 +++ new/pytest_mock-3.15.1/src/pytest_mock/_version.py 2025-09-16 18:36:30.000000000 +0200 @@ -28,7 +28,7 @@ commit_id: COMMIT_ID __commit_id__: COMMIT_ID -__version__ = version = '3.15.0' -__version_tuple__ = version_tuple = (3, 15, 0) +__version__ = version = '3.15.1' +__version_tuple__ = version_tuple = (3, 15, 1) __commit_id__ = commit_id = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/src/pytest_mock/plugin.py new/pytest_mock-3.15.1/src/pytest_mock/plugin.py --- old/pytest_mock-3.15.0/src/pytest_mock/plugin.py 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/src/pytest_mock/plugin.py 2025-09-16 18:36:26.000000000 +0200 @@ -157,13 +157,16 @@ """ self._mock_cache.remove(mock) - def spy(self, obj: object, name: str) -> MockType: + def spy( + self, obj: object, name: str, duplicate_iterators: bool = False + ) -> MockType: """ Create a spy of method. It will run method normally, but it is now possible to use `mock` call features with it, like call count. :param obj: An object. :param name: A method in object. + :param duplicate_iterators: Whether to keep a copy of the returned iterator in `spy_return_iter`. :return: Spy object. """ method = getattr(obj, name) @@ -177,7 +180,7 @@ spy_obj.spy_exception = e raise else: - if isinstance(r, Iterator): + if duplicate_iterators and isinstance(r, Iterator): r, duplicated_iterator = itertools.tee(r, 2) spy_obj.spy_return_iter = duplicated_iterator else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/src/pytest_mock.egg-info/PKG-INFO new/pytest_mock-3.15.1/src/pytest_mock.egg-info/PKG-INFO --- old/pytest_mock-3.15.0/src/pytest_mock.egg-info/PKG-INFO 2025-09-04 22:57:13.000000000 +0200 +++ new/pytest_mock-3.15.1/src/pytest_mock.egg-info/PKG-INFO 2025-09-16 18:36:30.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: pytest-mock -Version: 3.15.0 +Version: 3.15.1 Summary: Thin-wrapper around the mock package for easier use with pytest Author-email: Bruno Oliveira <[email protected]> License: MIT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/tests/test_pytest_mock.py new/pytest_mock-3.15.1/tests/test_pytest_mock.py --- old/pytest_mock-3.15.0/tests/test_pytest_mock.py 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/tests/test_pytest_mock.py 2025-09-16 18:36:26.000000000 +0200 @@ -540,13 +540,15 @@ @pytest.mark.parametrize("iterator", [(i for i in range(3)), iter([0, 1, 2])]) -def test_spy_return_iter(mocker: MockerFixture, iterator: Iterator[int]) -> None: +def test_spy_return_iter_duplicates_iterator_when_enabled( + mocker: MockerFixture, iterator: Iterator[int] +) -> None: class Foo: def bar(self) -> Iterator[int]: return iterator foo = Foo() - spy = mocker.spy(foo, "bar") + spy = mocker.spy(foo, "bar", duplicate_iterators=True) result = list(foo.bar()) assert result == [0, 1, 2] @@ -558,8 +560,27 @@ assert isinstance(return_value, Iterator) [email protected]("iterator", [(i for i in range(3)), iter([0, 1, 2])]) +def test_spy_return_iter_is_not_set_when_disabled( + mocker: MockerFixture, iterator: Iterator[int] +) -> None: + class Foo: + def bar(self) -> Iterator[int]: + return iterator + + foo = Foo() + spy = mocker.spy(foo, "bar", duplicate_iterators=False) + result = list(foo.bar()) + + assert result == [0, 1, 2] + assert spy.spy_return is not None + assert spy.spy_return_iter is None + [return_value] = spy.spy_return_list + assert isinstance(return_value, Iterator) + + @pytest.mark.parametrize("iterable", [(0, 1, 2), [0, 1, 2], range(3)]) -def test_spy_return_iter_ignore_plain_iterable( +def test_spy_return_iter_ignores_plain_iterable( mocker: MockerFixture, iterable: Iterable[int] ) -> None: class Foo: @@ -567,7 +588,7 @@ return iterable foo = Foo() - spy = mocker.spy(foo, "bar") + spy = mocker.spy(foo, "bar", duplicate_iterators=True) result = foo.bar() assert result == iterable @@ -587,7 +608,7 @@ return self.iterables.pop(0) foo = Foo() - spy = mocker.spy(foo, "bar") + spy = mocker.spy(foo, "bar", duplicate_iterators=True) result_iterator = list(foo.bar()) assert result_iterator == [0, 1, 2] @@ -643,7 +664,7 @@ expected = "\n ".join(util._compare_eq_iterable(left, right, verbose)) # type:ignore[arg-type] else: expected = "\n ".join( - util._compare_eq_iterable(left, right, lambda t, *_: t, verbose) + util._compare_eq_iterable(left, right, lambda t, *_, **__: t, verbose) # type:ignore[arg-type] ) assert expected in str(e) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_mock-3.15.0/tox.ini new/pytest_mock-3.15.1/tox.ini --- old/pytest_mock-3.15.0/tox.ini 2025-09-04 22:57:09.000000000 +0200 +++ new/pytest_mock-3.15.1/tox.ini 2025-09-16 18:36:26.000000000 +0200 @@ -5,6 +5,8 @@ [testenv] deps = coverage + # Used for standalone mock support. + mock pytest-asyncio pytest6: pytest==6.2.5 commands =
