Source code for schrodinger.test.hypothesis.hypothesis_profiles
from hypothesis import HealthCheck
from hypothesis import settings as hypothesis_settings
from hypothesis import Verbosity
[docs]def register_profiles():
"""Registers hypothesis profiles
# See http://hypothesis.readthedocs.io/en/latest/settings.html for details
Any profile added here will be available to py.test's --hypothesis-profile
option
Without any profile, Hypothesis will default to the following values:
max_examples = 200
stateful_step_count = 50
and will perform health checks by default.
As a general rule, developers should use the "dev" profile when running a
subset of tests as part of the development process and the "stress" profile
when they want to smoke out especially tricky bugs (or in stu tests).
Buildbot and the regular unittest process will use the "unittest" profile,
which is very lightweight compared to the others.
"""
hypothesis_settings.register_profile(
"dev",
hypothesis_settings(
max_examples=200,
deadline=None,
stateful_step_count=50,
verbosity=Verbosity.verbose,
))
hypothesis_settings.register_profile(
"stress",
hypothesis_settings(max_examples=500,
deadline=None,
stateful_step_count=100,
verbosity=Verbosity.verbose,
suppress_health_check=[HealthCheck.too_slow]))
unittest_settings = {
'max_examples': 15,
'deadline': None,
'stateful_step_count': 20,
'suppress_health_check': [
HealthCheck.too_slow, HealthCheck.data_too_large
]
}
hypothesis_settings.register_profile(
"unittest", hypothesis_settings(**unittest_settings))