diff --git a/.circleci/config.yml b/.circleci/config.yml index b367ad73570f6d4d942b9bb723de5db4f07a8dd1..6ad5add5b4f2fa0340907e3e1fd9559ce95df177 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,6 +53,7 @@ jobs: environment: PIP_SYNC_REQUIREMENTS: "requirements.txt requirements-tests.txt" + ZKAPAUTHORIZER_HYPOTHESIS_PROFILE: "ci" steps: - "checkout" diff --git a/src/_zkapauthorizer/tests/__init__.py b/src/_zkapauthorizer/tests/__init__.py index ddc6757790860f85c70d9c06d97bbf25baae8784..5019fa0eacdc71e14869e1c2dca6735e6626a433 100644 --- a/src/_zkapauthorizer/tests/__init__.py +++ b/src/_zkapauthorizer/tests/__init__.py @@ -15,3 +15,34 @@ """ The automated unit test suite. """ + +def _configure_hypothesis(): + """ + Select define Hypothesis profiles and select one based on environment + variables. + """ + from os import environ + + from hypothesis import ( + HealthCheck, + settings, + ) + + settings.register_profile( + "ci", + suppress_health_check=[ + # CPU resources available to CI builds typically varies + # significantly from run to run making it difficult to determine + # if "too slow" data generation is a result of the code or the + # execution environment. Prevent these checks from + # (intermittently) failing tests that are otherwise fine. + HealthCheck.too_slow, + ], + # With the same reasoning, disable the test deadline. + deadline=None, + ) + + profile_name = environ.get("ZKAPAUTHORIZER_HYPOTHESIS_PROFILE", "default") + settings.load_profile(profile_name) + +_configure_hypothesis()