diff --git a/changelog.d/19134.bugfix b/changelog.d/19134.bugfix new file mode 100644 index 0000000000..61e626cc9b --- /dev/null +++ b/changelog.d/19134.bugfix @@ -0,0 +1 @@ +Add support for Python 3.14. \ No newline at end of file diff --git a/tests/events/test_auto_accept_invites.py b/tests/events/test_auto_accept_invites.py index d3842e72d7..623ec67ed6 100644 --- a/tests/events/test_auto_accept_invites.py +++ b/tests/events/test_auto_accept_invites.py @@ -19,9 +19,8 @@ # # import asyncio -from asyncio import Future from http import HTTPStatus -from typing import Any, Awaitable, Optional, TypeVar, cast +from typing import Any, Optional, TypeVar, cast from unittest.mock import Mock import attr @@ -787,20 +786,12 @@ TV = TypeVar("TV") async def make_awaitable(value: T) -> T: + """ + Makes a fresh awaitable, suitable for mocking an `async` function. + """ return value -def make_multiple_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 create_module( config_override: Optional[dict[str, Any]] = None, worker_name: Optional[str] = None ) -> InviteAutoAccepter: @@ -809,7 +800,7 @@ def create_module( module_api = Mock(spec=ModuleApi) module_api.is_mine.side_effect = lambda a: a.split(":")[1] == "test" module_api.worker_name = worker_name - module_api.sleep.return_value = make_multiple_awaitable(None) + module_api.sleep.return_value = lambda *_args, **_kwargs: make_awaitable(None) module_api.get_userinfo_by_id.return_value = UserInfo( user_id=UserID.from_string("@user:test"), is_admin=False,