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
unittest.mock.patch.dict returns function when applied to coroutines
#98086
Labels
type-bug
An unexpected behavior, bug, or error
Comments
sobolevn
added a commit
to sobolevn/cpython
that referenced
this issue
Oct 8, 2022
cjw296
pushed a commit
that referenced
this issue
Nov 11, 2022
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 11, 2022
…onGH-98095) (cherry picked from commit 67b4d27) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This was referenced Nov 11, 2022
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 11, 2022
…onGH-98095) (cherry picked from commit 67b4d27) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
ethanfurman
pushed a commit
to ethanfurman/cpython
that referenced
this issue
Nov 12, 2022
cjw296
pushed a commit
that referenced
this issue
Nov 19, 2022
tirkarthi
pushed a commit
that referenced
this issue
Nov 20, 2022
|
Thanks everyone, looks like this has been fixed and backported |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
seifertm commentedOct 8, 2022
•
edited by bedevere-bot
Bug report
unittest.mock.patch.dictreturns a synchronous function when applied to coroutines. Contrary to that,unittest.mock.patchreturns coroutines when applied to coroutines (see #81177).My expectation is that
patchandpatch.dictbehave the same when applied to coroutines. I expect the following code to printTrueandTrue, but it printsTrueandFalsefor CPython>=3.8:Your environment
CPython v3.7 is not affected by this issue, because support for coroutines was added to
mock.patchin v3.8 (see #81177). The supplied example printsFalseandFalse.patch.dictcan decorate async functions (GH-98095) #99365patch.dictcan decorate async functions (GH-98095) #99366The text was updated successfully, but these errors were encountered: