pytest-mock
pytest-mock copied to clipboard
Patch methods should return AsyncMock if the target is an async method
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.
Hi @GDYendell, thanks for bringing this to attention.