aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-03-09 15:29:19 -0700
committerGravatar MarkKoz <[email protected]>2020-03-13 17:11:28 -0700
commit02fe32879be51b3f202501ea8cdc5314ca3b77b2 (patch)
tree6016303a7de87e7aa869a30c1814463fc1c2c7de
parentCog tests: fix nested modules not being found (diff)
Cog tests: fix duplicate commands being yielded
discord.py yields duplicate Command objects for each alias a command has, so the duplicates need to be removed on our end.
-rw-r--r--tests/bot/cogs/test_cogs.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/bot/cogs/test_cogs.py b/tests/bot/cogs/test_cogs.py
index 3a9f07db6..9d1d4ebea 100644
--- a/tests/bot/cogs/test_cogs.py
+++ b/tests/bot/cogs/test_cogs.py
@@ -21,7 +21,8 @@ class CommandNameTests(unittest.TestCase):
if command.parent is None:
yield command
if isinstance(command, commands.GroupMixin):
- yield from command.walk_commands()
+ # Annoyingly it returns duplicates for each alias so use a set to fix that
+ yield from set(command.walk_commands())
@staticmethod
def walk_modules() -> t.Iterator[ModuleType]: