aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bot/cogs/test_cogs.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/bot/cogs/test_cogs.py b/tests/bot/cogs/test_cogs.py
index b128ca123..386299fb1 100644
--- a/tests/bot/cogs/test_cogs.py
+++ b/tests/bot/cogs/test_cogs.py
@@ -1,10 +1,15 @@
"""Test suite for general tests which apply to all cogs."""
+import importlib
+import pkgutil
import typing as t
import unittest
+from types import ModuleType
from discord.ext import commands
+from bot import cogs
+
class CommandNameTests(unittest.TestCase):
"""Tests for shadowing command names and aliases."""
@@ -17,3 +22,9 @@ class CommandNameTests(unittest.TestCase):
yield command
if isinstance(command, commands.GroupMixin):
yield from command.walk_commands()
+
+ @staticmethod
+ def walk_extensions() -> t.Iterator[ModuleType]:
+ """Yield imported extensions (modules) from the bot.cogs subpackage."""
+ for module in pkgutil.iter_modules(cogs.__path__, "bot.cogs."):
+ yield importlib.import_module(module.name)