diff options
| author | 2020-03-04 17:19:00 -0500 | |
|---|---|---|
| committer | 2020-03-04 17:19:00 -0500 | |
| commit | c624c25a59e6d6e386c7b5f43ff578db7e29eab8 (patch) | |
| tree | b82e18a6102d2b11992fb8e7bcfc4d72b54b8d46 /tests/base.py | |
| parent | Convert "get_tags()" and "_get_tag()" to sync functions (diff) | |
| parent | Merge pull request #814 from python-discord/antimalware-logging (diff) | |
Merge branch 'master' into tags_overhaul
Diffstat (limited to 'tests/base.py')
| -rw-r--r-- | tests/base.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/base.py b/tests/base.py index 88693f382..d99b9ac31 100644 --- a/tests/base.py +++ b/tests/base.py @@ -22,11 +22,16 @@ class _CaptureLogHandler(logging.Handler): self.records.append(record) -class LoggingTestCase(unittest.TestCase): - """TestCase subclass that adds more logging assertion tools.""" +class LoggingTestsMixin: + """ + A mixin that defines additional test methods for logging behavior. + + This mixin relies on the availability of the `fail` attribute defined by the + test classes included in Python's unittest method to signal test failure. + """ @contextmanager - def assertNotLogs(self, logger=None, level=None, msg=None): + def assertNotLogs(self, logger=None, level=None, msg=None): # noqa: N802 """ Asserts that no logs of `level` and higher were emitted by `logger`. @@ -73,11 +78,10 @@ class LoggingTestCase(unittest.TestCase): self.fail(msg) -class CommandTestCase(unittest.TestCase): +class CommandTestCase(unittest.IsolatedAsyncioTestCase): """TestCase with additional assertions that are useful for testing Discord commands.""" - @helpers.async_test - async def assertHasPermissionsCheck( + async def assertHasPermissionsCheck( # noqa: N802 self, cmd: commands.Command, permissions: Dict[str, bool], |