]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (GH-94050) (GH-94461)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 30 Jun 2022 18:02:15 +0000 (11:02 -0700)
committerGitHub <noreply@github.com>
Thu, 30 Jun 2022 18:02:15 +0000 (20:02 +0200)
commit47f23b2d8a14a2f182375c840776eadfc371c726
tree76ead06fbb8909c527a9438d7069c795b71ce87f
parentd915ed297804041c822a595c0f44e52a4c385302
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (GH-94050) (GH-94461)

The inspect version was not working with unittest.mock.AsyncMock.

The fix introduces special-casing of AsyncMock in
`inspect.iscoroutinefunction` equivalent to the one
performed in `asyncio.iscoroutinefunction`.

Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
(cherry picked from commit 4261b6bffc0b8bb5c6d4d80578a81b7520f4aefc)

Co-authored-by: Mehdi ABAAKOUK <sileht@sileht.net>
Lib/inspect.py
Lib/test/test_asyncio/test_tasks.py
Lib/test/test_inspect.py
Lib/unittest/mock.py
Misc/NEWS.d/next/Library/2022-06-21-11-40-31.gh-issue-84753.FW1pxO.rst [new file with mode: 0644]