diff --git a/tests/test_utils/__init__.py b/tests/test_utils/__init__.py
index 21e112a8b5..fa731426cd 100644
--- a/tests/test_utils/__init__.py
+++ b/tests/test_utils/__init__.py
@@ -19,8 +19,7 @@ import json
import sys
import warnings
from binascii import unhexlify
-from typing import TYPE_CHECKING, Any, Awaitable, Callable, Optional, Tuple, TypeVar
-from unittest.mock import Mock
+from typing import TYPE_CHECKING, Awaitable, Callable, Tuple, TypeVar
import attr
import zope.interface
@@ -62,10 +61,6 @@ def setup_awaitable_errors() -> Callable[[], None]:
"""
warnings.simplefilter("error", RuntimeWarning)
- # unraisablehook was added in Python 3.8.
- if not hasattr(sys, "unraisablehook"):
- return lambda: None
-
# State shared between unraisablehook and check_for_unraisable_exceptions.
unraisable_exceptions = []
orig_unraisablehook = sys.unraisablehook
@@ -88,18 +83,6 @@ def setup_awaitable_errors() -> Callable[[], None]:
return cleanup
-def simple_async_mock(
- return_value: Optional[TV] = None, raises: Optional[Exception] = None
-) -> Mock:
- # AsyncMock is not available in python3.5, this mimics part of its behaviour
- async def cb(*args: Any, **kwargs: Any) -> Optional[TV]:
- if raises:
- raise raises
- return return_value
-
- return Mock(side_effect=cb)
-
-
# Type ignore: it does not fully implement IResponse, but is good enough for tests
@zope.interface.implementer(IResponse)
@attr.s(slots=True, frozen=True, auto_attribs=True)
|