aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-03-09 14:17:23 -0700
committerGravatar MarkKoz <[email protected]>2020-03-13 17:11:05 -0700
commit5419b3e9599e8bb2f519949aa268eb3a4b3adbcc (patch)
treebf804ab808b5699c8eb3b51fa0fda13f06e7cf07 /tests
parentCog tests: add a function to get all qualified names for a cmd (diff)
Cog tests: add a function to yield all commands
This will help reduce nesting in the actual test.
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/test_cogs.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/bot/cogs/test_cogs.py b/tests/bot/cogs/test_cogs.py
index e28717756..d260b46a7 100644
--- a/tests/bot/cogs/test_cogs.py
+++ b/tests/bot/cogs/test_cogs.py
@@ -43,3 +43,10 @@ class CommandNameTests(unittest.TestCase):
names.append(command.qualified_name)
return names
+
+ def get_all_commands(self) -> t.Iterator[commands.Command]:
+ """Yield all commands for all cogs in all extensions."""
+ for extension in self.walk_extensions():
+ for cog in self.walk_cogs(extension):
+ for cmd in self.walk_commands(cog):
+ yield cmd