diff options
author | 2020-03-09 14:17:23 -0700 | |
---|---|---|
committer | 2020-03-13 17:11:05 -0700 | |
commit | 5419b3e9599e8bb2f519949aa268eb3a4b3adbcc (patch) | |
tree | bf804ab808b5699c8eb3b51fa0fda13f06e7cf07 | |
parent | Cog 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.
-rw-r--r-- | tests/bot/cogs/test_cogs.py | 7 |
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 |