summaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest-mock/py3/pytest_mock
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-10-01 20:51:25 +0300
committerrobot-piglet <[email protected]>2025-10-01 21:04:10 +0300
commit594e8c2a0fdf288b605a334c78d424f3ef24369d (patch)
tree8c00d1409c057c76f262b13c1f1b2ff910a32a82 /contrib/python/pytest-mock/py3/pytest_mock
parent37cb3db9406ee2445a4a0d0cfb417da82347f9ae (diff)
Intermediate changes
commit_hash:f8824dd4709e9607499ae3cf7558efe1150fff92
Diffstat (limited to 'contrib/python/pytest-mock/py3/pytest_mock')
-rw-r--r--contrib/python/pytest-mock/py3/pytest_mock/_util.py2
-rw-r--r--contrib/python/pytest-mock/py3/pytest_mock/_version.py4
-rw-r--r--contrib/python/pytest-mock/py3/pytest_mock/plugin.py7
3 files changed, 8 insertions, 5 deletions
diff --git a/contrib/python/pytest-mock/py3/pytest_mock/_util.py b/contrib/python/pytest-mock/py3/pytest_mock/_util.py
index ad830caeefa..d3a732ac278 100644
--- a/contrib/python/pytest-mock/py3/pytest_mock/_util.py
+++ b/contrib/python/pytest-mock/py3/pytest_mock/_util.py
@@ -15,7 +15,7 @@ def get_mock_module(config):
config.getini("mock_use_standalone_module")
)
if use_standalone_module:
- from unittest import mock
+ import mock
_mock_module = mock
else:
diff --git a/contrib/python/pytest-mock/py3/pytest_mock/_version.py b/contrib/python/pytest-mock/py3/pytest_mock/_version.py
index 7b8272a4140..7b769ace60a 100644
--- a/contrib/python/pytest-mock/py3/pytest_mock/_version.py
+++ b/contrib/python/pytest-mock/py3/pytest_mock/_version.py
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
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 --git a/contrib/python/pytest-mock/py3/pytest_mock/plugin.py b/contrib/python/pytest-mock/py3/pytest_mock/plugin.py
index f4dbfc3ec6e..ef996121333 100644
--- a/contrib/python/pytest-mock/py3/pytest_mock/plugin.py
+++ b/contrib/python/pytest-mock/py3/pytest_mock/plugin.py
@@ -157,13 +157,16 @@ class MockerFixture:
"""
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 @@ class MockerFixture:
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: