python (3.12.0)
1 import os
2
3 try:
4 import hypothesis
5 except ImportError:
6 from . import _hypothesis_stubs as hypothesis
7 else:
8 # When using the real Hypothesis, we'll configure it to ignore occasional
9 # slow tests (avoiding flakiness from random VM slowness in CI).
10 hypothesis.settings.register_profile(
11 "slow-is-ok",
12 deadline=None,
13 suppress_health_check=[
14 hypothesis.HealthCheck.too_slow,
15 hypothesis.HealthCheck.differing_executors,
16 ],
17 )
18 hypothesis.settings.load_profile("slow-is-ok")
19
20 # For local development, we'll write to the default on-local-disk database
21 # of failing examples, and also use a pull-through cache to automatically
22 # replay any failing examples discovered in CI. For details on how this
23 # works, see https://hypothesis.readthedocs.io/en/latest/database.html
24 if "CI" not in os.environ:
25 from hypothesis.database import (
26 GitHubArtifactDatabase,
27 MultiplexedDatabase,
28 ReadOnlyDatabase,
29 )
30
31 hypothesis.settings.register_profile(
32 "cpython-local-dev",
33 database=MultiplexedDatabase(
34 hypothesis.settings.default.database,
35 ReadOnlyDatabase(GitHubArtifactDatabase("python", "cpython")),
36 ),
37 )
38 hypothesis.settings.load_profile("cpython-local-dev")