aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2019-10-12 00:21:30 +0200
committerGravatar GitHub <[email protected]>2019-10-12 00:21:30 +0200
commit9232071954c5124af686faf6a490bc0a6f5f5fc0 (patch)
treeace0b2915c88d9cc8db700d119e9abb030ac9a04 /tests/helpers.py
parentMerge remote-tracking branch 'origin/master' into modif_2 (diff)
parentMerge pull request #421 from python-discord/bot-utils-time-tests (diff)
Merge branch 'master' into modif_2
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 2908294f7..25059fa3a 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -7,6 +7,10 @@ __all__ = ('AsyncMock', 'async_test')
# TODO: Remove me on 3.8
+# Allows you to mock a coroutine. Since the default `__call__` of `MagicMock`
+# is not a coroutine, trying to mock a coroutine with it will result in errors
+# as the default `__call__` is not awaitable. Use this class for monkeypatching
+# coroutines instead.
class AsyncMock(MagicMock):
async def __call__(self, *args, **kwargs):
return super(AsyncMock, self).__call__(*args, **kwargs)