diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2023-08-24 19:38:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-24 19:38:46 -0400 |
commit | daf11e26efc210dccaef029422431a7d2803dd8a (patch) | |
tree | 7e42649714a38217d25eecf0a089592632dc989c /tests/test_utils | |
parent | Document `exclude_rooms_fom_sync` configuration option (#16178) (diff) | |
download | synapse-daf11e26efc210dccaef029422431a7d2803dd8a.tar.xz |
Replace make_awaitable with AsyncMock (#16179)
Python 3.8 provides a native AsyncMock, we can replace the homegrown version we have.
Diffstat (limited to 'tests/test_utils')
-rw-r--r-- | tests/test_utils/__init__.py | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/tests/test_utils/__init__.py b/tests/test_utils/__init__.py index c8cc841d95..21e112a8b5 100644 --- a/tests/test_utils/__init__.py +++ b/tests/test_utils/__init__.py @@ -18,7 +18,6 @@ Utilities for running the unit tests import json import sys import warnings -from asyncio import Future from binascii import unhexlify from typing import TYPE_CHECKING, Any, Awaitable, Callable, Optional, Tuple, TypeVar from unittest.mock import Mock @@ -57,17 +56,6 @@ def get_awaitable_result(awaitable: Awaitable[TV]) -> TV: raise Exception("awaitable has not yet completed") -def make_awaitable(result: TV) -> Awaitable[TV]: - """ - Makes an awaitable, suitable for mocking an `async` function. - This uses Futures as they can be awaited multiple times so can be returned - to multiple callers. - """ - future: Future[TV] = Future() - future.set_result(result) - return future - - def setup_awaitable_errors() -> Callable[[], None]: """ Convert warnings from a non-awaited coroutines into errors. |