summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorandrei kulakov <andrei.avk@gmail.com>2022-11-07 07:24:46 (GMT)
committerGitHub <noreply@github.com>2022-11-07 07:24:46 (GMT)
commitc6325b1c9fe60f72bb3fa4b8570a699e9e97af53 (patch)
tree05a9eefebd36ee790af947636a63aede36b32908 /Lib/unittest
parent728e42fcf51cbb2108caf1382df224c13b53d024 (diff)
downloadcpython-c6325b1c9fe60f72bb3fa4b8570a699e9e97af53.zip
cpython-c6325b1c9fe60f72bb3fa4b8570a699e9e97af53.tar.gz
cpython-c6325b1c9fe60f72bb3fa4b8570a699e9e97af53.tar.bz2
gh-91803: Mock - fix error when using autospec methods with seal (#92213)
Fixes https://github.com/python/cpython/issues/91803. Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/mock.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index b8f4e57..096b1a5 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -2745,6 +2745,7 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
_new_parent=parent,
**kwargs)
mock._mock_children[entry] = new
+ new.return_value = child_klass()
_check_signature(original, new, skipfirst=skipfirst)
# so functions created with _set_signature become instance attributes,