]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (#94050)
authorMehdi ABAAKOUK <sileht@sileht.net>
Thu, 30 Jun 2022 17:08:38 +0000 (19:08 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Jun 2022 17:08:38 +0000 (19:08 +0200)
commit4261b6bffc0b8bb5c6d4d80578a81b7520f4aefc
tree004df1f1a95ed6113b55ab0f92d3e66b405fd424
parent639e35108bc8b2b880225862d3571277ad57648b
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (#94050)

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>
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]