-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Can't call mocked methods after create_autospec() and seal() #91803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you set the return value beforehand or make a call to that method, you can.
This may be related to how
I'll look into it a little more |
I've added a draft PR #92213 , but I need to work on it a bit more. |
I think the PR may be good, if we consider Mock return value of methods as part of the autospec. That's what such methods return if there is no However I haven't used |
…213) Fixes python/cpython#91803. Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Backports: c6325b1c9fe60f72bb3fa4b8570a699e9e97af53 Signed-off-by: Chris Withers <chris@simplistix.co.uk>
…213) Fixes python/cpython#91803. Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Backports: c6325b1c9fe60f72bb3fa4b8570a699e9e97af53 Signed-off-by: Chris Withers <chris@simplistix.co.uk>
Bug report
The code below raises the error below. If I'm understanding the documentation for mock.seal correctly, it's supposed to prevent the creation of new attributes on the sealed mock, not prevent calls to existing methods, right?
Your environment
The text was updated successfully, but these errors were encountered: