def patch(
target, new=mock.DEFAULT, spec=None, create=False,
mocksignature=False, spec_set=None, autospec=False,
new_callable=None, **kwargs
):
"""Mocks an async function.
Should be a drop-in replacement for mock.patch that handles async automatically. The .asynq
attribute is automatically created and shouldn't be used when accessing data on
the mock.
"""
getter, attribute = _get_target(target)
return _make_patch_async(
getter, attribute, new, spec, create, mocksignature, spec_set, autospec, new_callable,
kwargs
)
评论列表
文章目录