aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar Akarys42 <[email protected]>2019-10-19 12:05:01 +0200
committerGravatar Akarys42 <[email protected]>2019-10-19 12:05:01 +0200
commitc6fe0050ba798932165fc74161e3739dcc453427 (patch)
tree6357417b042b9f33de977a9e5cb6aa71e9fb1c5d /tests/helpers.py
parentDelete “confirmation echo” (diff)
parentFix rule alias. (#537) (diff)
Merge branch 'master' of https://github.com/python-discord/bot into reminder-up
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)