aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest-mock/py3/pytest_mock/plugin.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2023-11-03 10:59:55 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-11-03 11:21:56 +0300
commit67017f403ebe21c47e170d88611517911405dccd (patch)
treeee30f4b42cd0763d08222f82bdded48bfccf239c /contrib/python/pytest-mock/py3/pytest_mock/plugin.py
parentebe5271b6b00155b318cd9b95b3ae7bc2cde1d10 (diff)
downloadydb-67017f403ebe21c47e170d88611517911405dccd.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/pytest-mock/py3/pytest_mock/plugin.py')
-rw-r--r--contrib/python/pytest-mock/py3/pytest_mock/plugin.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/python/pytest-mock/py3/pytest_mock/plugin.py b/contrib/python/pytest-mock/py3/pytest_mock/plugin.py
index 4e9609ad6a..673f98bffb 100644
--- a/contrib/python/pytest-mock/py3/pytest_mock/plugin.py
+++ b/contrib/python/pytest-mock/py3/pytest_mock/plugin.py
@@ -66,12 +66,20 @@ class MockerFixture:
self.call = mock_module.call
self.ANY = mock_module.ANY
self.DEFAULT = mock_module.DEFAULT
- self.create_autospec = mock_module.create_autospec
self.sentinel = mock_module.sentinel
self.mock_open = mock_module.mock_open
if hasattr(mock_module, "seal"):
self.seal = mock_module.seal
+ def create_autospec(
+ self, spec: Any, spec_set: bool = False, instance: bool = False, **kwargs: Any
+ ) -> MockType:
+ m: MockType = self.mock_module.create_autospec(
+ spec, spec_set, instance, **kwargs
+ )
+ self._patches_and_mocks.append((None, m))
+ return m
+
def resetall(
self, *, return_value: bool = False, side_effect: bool = False
) -> None:
@@ -102,7 +110,8 @@ class MockerFixture:
times.
"""
for p, m in reversed(self._patches_and_mocks):
- p.stop()
+ if p is not None:
+ p.stop()
self._patches_and_mocks.clear()
def stop(self, mock: unittest.mock.MagicMock) -> None: