aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar Xithrius <[email protected]>2021-09-26 12:23:37 -0700
committerGravatar GitHub <[email protected]>2021-09-26 12:23:37 -0700
commite98719a5fc4026bf01a8a3a762707bc4f888243c (patch)
tree1bfa2fc72ec8b29a3cafa7865b5d7d8b63165b8f /tests/helpers.py
parentMerge pull request #1846 from python-discord/suppress-notfound-messages-on-de... (diff)
parentMerge branch 'main' into scheduling-create_task-init (diff)
Merge pull request #1825 from Numerlor/scheduling-create_task-init
Use scheduling create_task util to create tasks
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 3978076ed..47f06f292 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -278,7 +278,10 @@ def _get_mock_loop() -> unittest.mock.Mock:
# Since calling `create_task` on our MockBot does not actually schedule the coroutine object
# as a task in the asyncio loop, this `side_effect` calls `close()` on the coroutine object
# to prevent "has not been awaited"-warnings.
- loop.create_task.side_effect = lambda coroutine: coroutine.close()
+ def mock_create_task(coroutine, **kwargs):
+ coroutine.close()
+ return unittest.mock.Mock()
+ loop.create_task.side_effect = mock_create_task
return loop