pytest-mock icon indicating copy to clipboard operation
pytest-mock copied to clipboard

Patch methods should return AsyncMock if the target is an async method

Open GDYendell opened this issue 3 years ago • 1 comments

This would match the behaviour of the equivalent methods in mock

Currently, I can pass new_callable=AsyncMock to make it work, but then mypy type checking fails because the type hints state that the methods return MagicMock. The return type is a union in the mock stubs.

GDYendell avatar Aug 23 '21 11:08 GDYendell

Hi @GDYendell, thanks for bringing this to attention.

nicoddemus avatar Aug 24 '21 13:08 nicoddemus