Add a "flaky" hypothesis profile to find flaky tests
Marco Ricci

Marco Ricci commited on 2025-01-25 20:59:05
Zeige 2 geänderte Dateien mit 5 Einfügungen und 0 Löschungen.


Also add coverage-compatible settings to one hypothesis test that was
still missing them, which was identified as flaky under this new
profile.
... ...
@@ -6,6 +6,7 @@ from __future__ import annotations
6 6
 
7 7
 import base64
8 8
 import contextlib
9
+import datetime
9 10
 import operator
10 11
 import os
11 12
 import shutil
... ...
@@ -31,6 +32,9 @@ hypothesis.settings.register_profile('dev', max_examples=10)
31 32
 hypothesis.settings.register_profile(
32 33
     'debug', max_examples=10, verbosity=hypothesis.Verbosity.verbose
33 34
 )
35
+hypothesis.settings.register_profile(
36
+    'flaky', deadline=datetime.timedelta(milliseconds=150)
37
+)
34 38
 
35 39
 
36 40
 # https://docs.pytest.org/en/stable/explanation/fixtures.html#a-note-about-fixture-cleanup
... ...
@@ -2562,6 +2562,7 @@ Boo.
2562 2562
                 assert result.clean_exit()
2563 2563
             assert cli._load_config() == config
2564 2564
 
2565
+    @tests.hypothesis_settings_coverage_compatible
2565 2566
     @hypothesis.given(
2566 2567
         global_config_settable=tests.vault_full_service_config(),
2567 2568
         global_config_importable=strategies.fixed_dictionaries(
2568 2569