aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2020-02-29 13:24:24 +0100
committerGravatar GitHub <[email protected]>2020-02-29 13:24:24 +0100
commitee73d45b3995a4e25109570f1ab0292c7783f3e1 (patch)
treeb4054c0e052ec4839f3a1cc06b42f8ecd01c646a /tests/helpers.py
parentScheduler: correct type annotations (diff)
parentMerge pull request #797 from Numerlor/fuzzy_zero_div (diff)
Merge branch 'master' into bug/backend/b754/scheduler-suppresses-errors
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 9d9dd5da6..6f50f6ae3 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -128,6 +128,18 @@ class AsyncMock(CustomMockMixin, unittest.mock.MagicMock):
return super().__call__(*args, **kwargs)
+class AsyncContextManagerMock(unittest.mock.MagicMock):
+ def __init__(self, return_value: Any):
+ super().__init__()
+ self._return_value = return_value
+
+ async def __aenter__(self):
+ return self._return_value
+
+ async def __aexit__(self, *args):
+ pass
+
+
class AsyncIteratorMock:
"""
A class to mock asynchronous iterators.