1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
"""Shared pytest fixtures + Hypothesis profile registration.
Registers three Hypothesis profiles chosen at collection time via the
``EDIFY_HYPOTHESIS_PROFILE`` environment variable:
* ``dev`` (default) — fast, 50 examples per property.
* ``ci`` — 300 examples, deterministic seed via HYPOTHESIS_DATABASE_FILE.
* ``nightly`` — 2000 examples with the shrinker granted extra time.
"""
from __future__ import annotations
import os
import sys
from pathlib import Path
from hypothesis import HealthCheck, Verbosity, settings
_REPO_ROOT = Path(__file__).parent.parent
if str(_REPO_ROOT) not in sys.path:
sys.path.insert(0, str(_REPO_ROOT))
_PROFILE_ENVIRONMENT_VARIABLE = "EDIFY_HYPOTHESIS_PROFILE"
settings.register_profile(
"dev",
max_examples=50,
deadline=None,
verbosity=Verbosity.normal,
suppress_health_check=[HealthCheck.too_slow],
)
settings.register_profile(
"ci",
max_examples=300,
deadline=None,
verbosity=Verbosity.normal,
suppress_health_check=[HealthCheck.too_slow],
)
settings.register_profile(
"nightly",
max_examples=2000,
deadline=None,
verbosity=Verbosity.verbose,
suppress_health_check=[HealthCheck.too_slow],
)
_chosen_profile = os.environ.get(_PROFILE_ENVIRONMENT_VARIABLE, "dev")
settings.load_profile(_chosen_profile)
|