From 61c81e05b6f8f8914f5238979706a028fde0de85 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 19 Feb 2024 16:22:39 -0500 Subject: [PATCH] Set up hypothesis profiles in dev/ci environments --- cmsmanage/settings/ci.py | 5 +++++ cmsmanage/settings/dev_base.py | 8 ++++++++ cmsmanage/settings/hypothesis.py | 7 +++++++ 3 files changed, 20 insertions(+) create mode 100644 cmsmanage/settings/hypothesis.py diff --git a/cmsmanage/settings/ci.py b/cmsmanage/settings/ci.py index f9aa2dc..4462fc8 100644 --- a/cmsmanage/settings/ci.py +++ b/cmsmanage/settings/ci.py @@ -1,4 +1,7 @@ +from hypothesis import settings + from .base import * # noqa: F403 +from .hypothesis import configure_hypothesis_profiles # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ @@ -31,3 +34,5 @@ DATABASES = { }, }, } +configure_hypothesis_profiles() +settings.load_profile("ci") diff --git a/cmsmanage/settings/dev_base.py b/cmsmanage/settings/dev_base.py index b22a088..dd6de70 100644 --- a/cmsmanage/settings/dev_base.py +++ b/cmsmanage/settings/dev_base.py @@ -1,4 +1,9 @@ +import os + +from hypothesis import settings + from .base import * # noqa: F403 +from .hypothesis import configure_hypothesis_profiles # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ @@ -13,3 +18,6 @@ INSTALLED_APPS.append("debug_toolbar") # noqa: F405 INSTALLED_APPS.append("django_extensions") # noqa: F405 MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405 + +configure_hypothesis_profiles() +settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "dev")) diff --git a/cmsmanage/settings/hypothesis.py b/cmsmanage/settings/hypothesis.py new file mode 100644 index 0000000..7c5d430 --- /dev/null +++ b/cmsmanage/settings/hypothesis.py @@ -0,0 +1,7 @@ +from hypothesis import HealthCheck, Verbosity, settings + + +def configure_hypothesis_profiles(): + settings.register_profile("ci", suppress_health_check=(HealthCheck.too_slow,)) + settings.register_profile("dev", max_examples=20) + settings.register_profile("debug", max_examples=10, verbosity=Verbosity.verbose)