Skip to content

Commit 612e3ef

Browse files
committed
Tweak profiles
Closes #3010
1 parent 11b6f3c commit 612e3ef

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

.github/workflows/hypothesis.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ jobs:
3131

3232
steps:
3333
- uses: actions/checkout@v4
34+
- name: Set HYPOTHESIS_PROFILE based on trigger
35+
run: |
36+
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
37+
echo "HYPOTHESIS_PROFILE=nightly" >> $GITHUB_ENV
38+
else
39+
echo "HYPOTHESIS_PROFILE=ci" >> $GITHUB_ENV
40+
fi
3441
- name: Set up Python
3542
uses: actions/setup-python@v5
3643
with:
@@ -58,6 +65,7 @@ jobs:
5865
if: success()
5966
id: status
6067
run: |
68+
echo "Using Hypothesis profile: $HYPOTHESIS_PROFILE"
6169
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-hypothesis
6270
6371
# explicitly save the cache so it gets updated, also do this even if it fails.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ run = "run-coverage --no-cov"
166166
run-pytest = "run"
167167
run-verbose = "run-coverage --verbose"
168168
run-mypy = "mypy src"
169-
run-hypothesis = "run-coverage -nauto --hypothesis-profile ci --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful*"
169+
run-hypothesis = "run-coverage -nauto --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful*"
170170
list-env = "pip list"
171171

172172
[tool.hatch.envs.doctest]

tests/conftest.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import os
34
import pathlib
45
from dataclasses import dataclass, field
56
from typing import TYPE_CHECKING
@@ -188,17 +189,28 @@ def pytest_collection_modifyitems(config: Any, items: Any) -> None:
188189

189190

190191
settings.register_profile(
191-
"ci",
192-
max_examples=1000,
193-
deadline=None,
192+
"default",
193+
parent=settings.get_profile("default"),
194+
max_examples=300,
194195
suppress_health_check=[HealthCheck.filter_too_much, HealthCheck.too_slow],
196+
verbosity=Verbosity.verbose,
195197
)
196198
settings.register_profile(
197-
"local",
198-
max_examples=300,
199+
"ci",
200+
parent=settings.get_profile("ci"),
201+
max_examples=200,
202+
derandomize=True, # more like regression testing
199203
suppress_health_check=[HealthCheck.filter_too_much, HealthCheck.too_slow],
200-
verbosity=Verbosity.verbose,
201204
)
205+
settings.register_profile(
206+
"nightly",
207+
parent=settings.get_profile("ci"),
208+
derandomize=False,
209+
stateful_step_count=100,
210+
)
211+
212+
settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default"))
213+
202214

203215
# TODO: uncomment these overrides when we can get mypy to accept them
204216
"""

0 commit comments

Comments
 (0)