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(