From 41cbc96b26e84d36f843c593e0161baedbd047ba Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 28 Jul 2026 09:44:48 +0000 Subject: [PATCH] Remove throwaway Rust HttpClient constructions from tests These existed only to force the tokio thread pool to start before reactor.run() under the old callWhenRunning-based startup. Now that the pool starts lazily on first use, the constructions (and the make_homeserver overrides that existed solely to host them) are dead weight. The tearDown hooks that fire the reactor shutdown triggers stay: they are still what stops the tokio pool for tests that exercise the Rust /versions handler. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01HyuiV3m44ZbK9o24EnMMES --- tests/push/test_http.py | 14 -------------- tests/rest/client/test_delayed_events.py | 14 -------------- tests/rest/client/test_login_token_request.py | 9 --------- tests/rest/client/test_matrixrtc.py | 14 -------------- tests/rest/client/test_versions.py | 14 -------------- 5 files changed, 65 deletions(-) diff --git a/tests/push/test_http.py b/tests/push/test_http.py index 9d748b727e..bd2ada9155 100644 --- a/tests/push/test_http.py +++ b/tests/push/test_http.py @@ -31,7 +31,6 @@ from synapse.rest import admin from synapse.rest.admin.experimental_features import ExperimentalFeature from synapse.rest.client import login, push_rule, pusher, receipts, room, versions from synapse.server import HomeServer -from synapse.synapse_rust.http_client import HttpClient from synapse.types import JsonDict from synapse.util.clock import Clock @@ -1233,19 +1232,6 @@ class MSC3881VersionsTestCase(HomeserverTestCase): versions.register_servlets, ] - def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: - hs = self.setup_test_homeserver() - - self._http_client = hs.get_proxied_http_client() - # The tokio thread pool is started lazily on first use, so no - # reactor startup hooks need to run here. - _ = HttpClient( - runtime=hs.get_rust_runtime(), - user_agent=self._http_client.user_agent.decode("utf8"), - ) - - return hs - def tearDown(self) -> None: # MemoryReactor doesn't trigger the shutdown phases, and we want the # Tokio thread pool to be stopped diff --git a/tests/rest/client/test_delayed_events.py b/tests/rest/client/test_delayed_events.py index c97ac1ec49..451a9127c1 100644 --- a/tests/rest/client/test_delayed_events.py +++ b/tests/rest/client/test_delayed_events.py @@ -24,7 +24,6 @@ from synapse.api.errors import Codes from synapse.rest import admin from synapse.rest.client import delayed_events, login, room, sync, versions from synapse.server import HomeServer -from synapse.synapse_rust.http_client import HttpClient from synapse.types import JsonDict from synapse.util.clock import Clock from synapse.util.duration import Duration @@ -41,19 +40,6 @@ _EVENT_TYPE = "com.example.test" class DelayedEventsUnstableSupportTestCase(HomeserverTestCase): servlets = [versions.register_servlets] - def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: - hs = self.setup_test_homeserver() - - self._http_client = hs.get_proxied_http_client() - # The tokio thread pool is started lazily on first use, so no - # reactor startup hooks need to run here. - _ = HttpClient( - runtime=hs.get_rust_runtime(), - user_agent=self._http_client.user_agent.decode("utf8"), - ) - - return hs - def tearDown(self) -> None: # MemoryReactor doesn't trigger the shutdown phases, and we want the # Tokio thread pool to be stopped diff --git a/tests/rest/client/test_login_token_request.py b/tests/rest/client/test_login_token_request.py index a0b3ef7995..b387cb98fb 100644 --- a/tests/rest/client/test_login_token_request.py +++ b/tests/rest/client/test_login_token_request.py @@ -24,7 +24,6 @@ from twisted.internet.testing import MemoryReactor from synapse.rest import admin from synapse.rest.client import login, login_token_request, versions from synapse.server import HomeServer -from synapse.synapse_rust.http_client import HttpClient from synapse.util.clock import Clock from tests import unittest @@ -48,14 +47,6 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase): self.hs.config.registration.auto_join_rooms = [] self.hs.config.captcha.enable_registration_captcha = False - self._http_client = self.hs.get_proxied_http_client() - # The tokio thread pool is started lazily on first use, so no - # reactor startup hooks need to run here. - _ = HttpClient( - runtime=self.hs.get_rust_runtime(), - user_agent=self._http_client.user_agent.decode("utf8"), - ) - return self.hs def tearDown(self) -> None: diff --git a/tests/rest/client/test_matrixrtc.py b/tests/rest/client/test_matrixrtc.py index 3c402ff725..68fedb0e56 100644 --- a/tests/rest/client/test_matrixrtc.py +++ b/tests/rest/client/test_matrixrtc.py @@ -22,7 +22,6 @@ from twisted.internet.testing import MemoryReactor from synapse.rest import admin from synapse.rest.client import login, matrixrtc, register, room, versions from synapse.server import HomeServer -from synapse.synapse_rust.http_client import HttpClient from synapse.util.clock import Clock from tests import unittest @@ -112,19 +111,6 @@ class MatrixRtcVersionsTestCase(HomeserverTestCase): servlets = [versions.register_servlets] - def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: - hs = self.setup_test_homeserver() - - self._http_client = hs.get_proxied_http_client() - # The tokio thread pool is started lazily on first use, so no - # reactor startup hooks need to run here. - _ = HttpClient( - runtime=hs.get_rust_runtime(), - user_agent=self._http_client.user_agent.decode("utf8"), - ) - - return hs - def tearDown(self) -> None: # MemoryReactor doesn't trigger the shutdown phases, and we want the # Tokio thread pool to be stopped diff --git a/tests/rest/client/test_versions.py b/tests/rest/client/test_versions.py index 171e2189db..d0af8268e5 100644 --- a/tests/rest/client/test_versions.py +++ b/tests/rest/client/test_versions.py @@ -17,7 +17,6 @@ from twisted.internet.testing import MemoryReactor from synapse.rest import admin from synapse.rest.client import login, versions from synapse.server import HomeServer -from synapse.synapse_rust.http_client import HttpClient from synapse.types import JsonDict from synapse.util.clock import Clock @@ -37,19 +36,6 @@ class VersionsTestCase(unittest.HomeserverTestCase): versions.register_servlets, ] - def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: - hs = self.setup_test_homeserver() - - self._http_client = hs.get_proxied_http_client() - # The tokio thread pool is started lazily on first use, so no - # reactor startup hooks need to run here. - _ = HttpClient( - runtime=hs.get_rust_runtime(), - user_agent=self._http_client.user_agent.decode("utf8"), - ) - - return hs - def tearDown(self) -> None: # MemoryReactor doesn't trigger the shutdown phases, and we want the # Tokio thread pool to be stopped