mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-38163: Child mocks detect their type as sync or async (GH-16471)
This commit is contained in:
parent
5bcc6d89bc
commit
3667e1ee6c
4 changed files with 76 additions and 28 deletions
|
@ -992,8 +992,9 @@ class NonCallableMock(Base):
|
|||
# Any asynchronous magic becomes an AsyncMock
|
||||
klass = AsyncMock
|
||||
elif issubclass(_type, AsyncMockMixin):
|
||||
if _new_name in _all_sync_magics:
|
||||
# Any synchronous magic becomes a MagicMock
|
||||
if (_new_name in _all_sync_magics or
|
||||
self._mock_methods and _new_name in self._mock_methods):
|
||||
# Any synchronous method on AsyncMock becomes a MagicMock
|
||||
klass = MagicMock
|
||||
else:
|
||||
klass = AsyncMock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue