diff options
author | 2020-04-17 13:07:33 +0100 | |
---|---|---|
committer | 2020-04-17 13:07:33 +0100 | |
commit | 80fd8e139bcfad01fd4a3c8cbd5abfee9b2a735a (patch) | |
tree | 63738db5332eb75d447b8a3238b78ff301620389 | |
parent | Remove `.md` from anti-malware whitelist (diff) | |
parent | Merge branch 'master' into syncer-timeout-fix (diff) |
Merge pull request #874 from ks129/syncer-timeout-fix
Fix wrong exception type in syncing
-rw-r--r-- | bot/cogs/sync/syncers.py | 3 | ||||
-rw-r--r-- | tests/bot/cogs/sync/test_base.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/bot/cogs/sync/syncers.py b/bot/cogs/sync/syncers.py index 003bf3727..e55bf27fd 100644 --- a/bot/cogs/sync/syncers.py +++ b/bot/cogs/sync/syncers.py @@ -1,4 +1,5 @@ import abc +import asyncio import logging import typing as t from collections import namedtuple @@ -122,7 +123,7 @@ class Syncer(abc.ABC): check=partial(self._reaction_check, author, message), timeout=constants.Sync.confirm_timeout ) - except TimeoutError: + except asyncio.TimeoutError: # reaction will remain none thus sync will be aborted in the finally block below. log.debug(f"The {self.name} syncer confirmation prompt timed out.") diff --git a/tests/bot/cogs/sync/test_base.py b/tests/bot/cogs/sync/test_base.py index 6ee9dfda6..70aea2bab 100644 --- a/tests/bot/cogs/sync/test_base.py +++ b/tests/bot/cogs/sync/test_base.py @@ -1,3 +1,4 @@ +import asyncio import unittest from unittest import mock @@ -211,7 +212,7 @@ class SyncerConfirmationTests(unittest.IsolatedAsyncioTestCase): subtests = ( (constants.Emojis.check_mark, True, None), ("InVaLiD", False, None), - (None, False, TimeoutError), + (None, False, asyncio.TimeoutError), ) for emoji, ret_val, side_effect in subtests: |