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 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-31 17:44:51 +01:00
1 parent 69e0d967a0
commit 43bd6583e6
2 files changed
+8 -9

No files matched your search

@@ -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)
@@ -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(