From 43bd6583e6e157433f2922ffe81f4e648fdaf940 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 31 Oct 2026 17:44:51 +0100 Subject: [PATCH] test(web-app-docs): reuse StopBuilderError in the timeout loop test and merge its nested with Gate pass 9 on the merged store-i18n stopped at ruff N818 on the local Stop exception that the builder-timeout test defined next to the module's StopBuilderError from the build-before-clone tests, plus SIM117 on the nested with in the healthy-mirror test. Co-Authored-By: Claude Opus 5.5 --- .../files/infinito_docs/test_build_queue.py | 7 ++----- .../web-app-docs/files/infinito_docs/test_library.py | 10 ++++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py b/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py index 92d84c4dc0..0af5981335 100644 --- a/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py +++ b/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py @@ -238,20 +238,17 @@ class TestBuilderLoop(QueueFixture, unittest.TestCase): attempts: list = [] sleeps: list = [] - class Stop(Exception): - pass - def sleep(seconds): sleeps.append(seconds) if len(sleeps) > 1: - raise Stop + raise StopBuilderError clock = SimpleNamespace(monotonic=time.monotonic, sleep=sleep) with ( patch.object(subprocess, "run", timed_out_clone(attempts)), patch.object(build_queue, "time", clock), redirect_stderr(io.StringIO()) as stderr, - self.assertRaises(Stop), + self.assertRaises(StopBuilderError), ): shelf.run_builder(0) diff --git a/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_library.py b/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_library.py index 6ab3d5b651..19532eb2e0 100644 --- a/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_library.py +++ b/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_library.py @@ -347,11 +347,13 @@ class TestClone(LibraryFixture): ) shelf.fetch() attempts: list = [] - with patch.object( - subprocess, "run", timed_out_clone(attempts, unresolved_head=True) + with ( + patch.object( + subprocess, "run", timed_out_clone(attempts, unresolved_head=True) + ), + self.assertRaises(subprocess.TimeoutExpired), ): - with self.assertRaises(subprocess.TimeoutExpired): - shelf.fetch() + shelf.fetch() self.assertEqual(len(attempts), 1) self.assertEqual(