Message343230
I guess cause is at [0] . When there is no new value specified and with spec being None if mock.patch is used on an async object (original = _accept_connection2). Here original is an async object then AsyncMock is returned.
Changing this causes test failures where patching AsyncClass.async_method now expects an AsyncMock but as per older behavior it returns MagicMock. I think it's a behavior that needs to be discussed as it differs from 3.7 and not sure if AsyncMock would always be awaited as seen in test_accept_connection_multiple.
[0] https://github.com/python/cpython/blob/b121f63155d8e3c7c42ab6122e36eaf7f5e9f7f5/Lib/unittest/mock.py#L1313
if spec is None and _is_async_obj(original):
Klass = AsyncMock
else:
Klass = MagicMock |
|
Date |
User |
Action |
Args |
2019-05-22 19:16:28 | xtreak | set | recipients:
+ xtreak, asvetlov, lisroach, mariocj89 |
2019-05-22 19:16:28 | xtreak | set | messageid: <1558552588.71.0.312582942802.issue37015@roundup.psfhosted.org> |
2019-05-22 19:16:28 | xtreak | link | issue37015 messages |
2019-05-22 19:16:28 | xtreak | create | |
|