diff options
author | 2020-03-09 14:49:08 -0700 | |
---|---|---|
committer | 2020-03-13 17:11:05 -0700 | |
commit | 78327b9fa7c64a04d527fce582b93210356451fe (patch) | |
tree | 71be4154342d9ce03877e270bcad42cd2eb4b09a | |
parent | Cog tests: fix Cog type check in `walk_cogs` (diff) |
Cog tests: fix duplicate cogs being yielded
Have to check the modules are equal to prevent yielding imported cogs.
-rw-r--r-- | tests/bot/cogs/test_cogs.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/bot/cogs/test_cogs.py b/tests/bot/cogs/test_cogs.py index 75aa1dbf6..de0982c93 100644 --- a/tests/bot/cogs/test_cogs.py +++ b/tests/bot/cogs/test_cogs.py @@ -33,7 +33,8 @@ class CommandNameTests(unittest.TestCase): def walk_cogs(extension: ModuleType) -> t.Iterator[commands.Cog]: """Yield all cogs defined in an extension.""" for obj in extension.__dict__.values(): - if isinstance(obj, type) and issubclass(obj, commands.Cog): + is_cog = isinstance(obj, type) and issubclass(obj, commands.Cog) + if is_cog and obj.__module__ == extension.__name__: yield obj @staticmethod |