From f2f78739d49e9c77056ca605510ac65a93e379fc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 26 Aug 2026 04:58:46 +0000 Subject: [PATCH] test: extract shared _skip_preflight helper in test_runner.py _build_runner and _build_visualize_override_runner each defined a byte-identical local async no-op _skip_preflight(url) closure used to stub out VisualQARunner._preflight_url for tests. Hoisted it to a single module-level function that both builders now reference, matching this file's established convention of factoring out duplicated test scaffolding (_build_* fixtures, _make_response, _check_messages, etc.). --- tests/test_runner.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/test_runner.py b/tests/test_runner.py index 4e81605..0d64cbe 100644 --- a/tests/test_runner.py +++ b/tests/test_runner.py @@ -226,6 +226,12 @@ async def verify(self, *args: Any, **kwargs: Any) -> ClaimResult: return self.results.pop(0) +async def _skip_preflight(url: str) -> None: + """No-op ``_preflight_url`` replacement for tests that don't want the real HTTP HEAD probe.""" + del url + return None + + def _build_runner( module: Any, tmp_path: Path, @@ -262,10 +268,6 @@ def _build_runner( if hasattr(verifier, "browser_manager"): verifier.browser_manager = browser - async def _skip_preflight(url: str) -> None: - del url - return None - setattr(runner, "_preflight_url", _skip_preflight) return runner, browser, verifier @@ -293,10 +295,6 @@ def _build_visualize_override_runner( navigator_client=FakeNavigatorClient([]), ) - async def _skip_preflight(url: str) -> None: - del url - return None - runner._preflight_url = _skip_preflight return runner