Relax hypothesis deadline for another slow-ish test
Marco Ricci

Marco Ricci commited on 2024-10-03 13:30:36
Zeige 1 geänderte Dateien mit 13 Einfügungen und 0 Löschungen.


The vault settings validation test keeps timing out on my older
hardware, when running without the C tracer and at moderate power saving
settings.  I can only presume it would time out similarly on even
lower-powered hardware, such as a Raspberry Pi.
... ...
@@ -297,7 +297,20 @@ def vault_config(draw: strategies.DrawFn) -> dict[str, int]:
297 297
     }
298 298
 
299 299
 
300
+# TODO(@the-13th-letter): Since all tests in this class manipulate the
301
+# hypothesis deadline setting, perhaps it is more sensible to move this
302
+# manipulation into a separate decorator, or a fixture.
300 303
 class TestHypotheses:
304
+    # This test tends to time out when using coverage without the
305
+    # C tracer, which in my testing leads to a roughly 40-fold execution
306
+    # time. So reset the deadline accordingly.
307
+    @hypothesis.settings(
308
+        deadline=(
309
+            40 * deadline  # type: ignore[name-defined]
310
+            if (deadline := hypothesis.settings().deadline) is not None
311
+            else None
312
+        )
313
+    )
301 314
     @hypothesis.given(
302 315
         phrase=strategies.one_of(
303 316
             strategies.binary(min_size=1), strategies.text(min_size=1)
304 317