aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar wookie184 <[email protected]>2023-07-09 09:44:30 +0100
committerGravatar GitHub <[email protected]>2023-07-09 09:44:30 +0100
commita5b8099a7b4da288058d852a8f303a46154fb6bc (patch)
tree4dd957019310b9760ea2f38949b1f02e2edacdb8 /tests/helpers.py
parentOptimise startup time (#2662) (diff)
Fix some test warnings (#2675)
* Fix test warnings * Remove unnecessary event_loop parameters This is not necessary as the current event loop will be used which is the same as self.bot.loop. Removing these should slightly improve test speed as the mock for self.bot.loop doesn't need to be created.
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 26ac42697..580848c25 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -6,6 +6,7 @@ import logging
import unittest.mock
from asyncio import AbstractEventLoop
from collections.abc import Iterable
+from contextlib import contextmanager
from functools import cached_property
import discord
@@ -664,3 +665,12 @@ class MockAsyncWebhook(CustomMockMixin, unittest.mock.MagicMock):
"""
spec_set = webhook_instance
additional_spec_asyncs = ("send", "edit", "delete", "execute")
+
+@contextmanager
+def no_create_task():
+ def side_effect(coro, *_, **__):
+ coro.close()
+
+ with unittest.mock.patch("pydis_core.utils.scheduling.create_task") as create_task:
+ create_task.side_effect = side_effect
+ yield