Skip to content

Commit 338b766

Browse files
committed
Config for property-based tests
1 parent d5b3dfd commit 338b766

4 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ jobs:
55
32bit-and-parallel:
66
docker:
77
- image: quay.io/pypa/manylinux1_i686
8+
environment:
9+
HYPOTHESIS_PROFILE: ci
810
steps:
911
- checkout
1012
- run:
@@ -42,6 +44,8 @@ jobs:
4244
image-tests-mpl212:
4345
docker:
4446
- image: astropy/image-tests-py36-mpl212:1.10
47+
environment:
48+
HYPOTHESIS_PROFILE: ci
4549
steps:
4650
- checkout
4751
- run:
@@ -56,6 +60,8 @@ jobs:
5660
image-tests-mpl222:
5761
docker:
5862
- image: astropy/image-tests-py36-mpl222:1.10
63+
environment:
64+
HYPOTHESIS_PROFILE: ci
5965
steps:
6066
- checkout
6167
- run:
@@ -70,6 +76,8 @@ jobs:
7076
image-tests-mpl302:
7177
docker:
7278
- image: astropy/image-tests-py37-mpl302:1.10
79+
environment:
80+
HYPOTHESIS_PROFILE: ci
7381
steps:
7482
- checkout
7583
- run:
@@ -84,6 +92,8 @@ jobs:
8492
image-tests-mpl310:
8593
docker:
8694
- image: astropy/image-tests-py37-mpl311:1.10
95+
environment:
96+
HYPOTHESIS_PROFILE: ci
8797
steps:
8898
- checkout
8999
- run:
@@ -98,6 +108,8 @@ jobs:
98108
image-tests-mpldev:
99109
docker:
100110
- image: astropy/image-tests-py37-base:1.4
111+
environment:
112+
HYPOTHESIS_PROFILE: ci
101113
steps:
102114
- checkout
103115
- run:

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ venv
5555
.coverage
5656
cover
5757
htmlcov
58+
.hypothesis
5859

5960
# Mac OSX
6061
.DS_Store

‎.travis.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ env:
5151
# to open a GUI window.
5252
- SETUP_XVFB=True
5353

54+
# Select a Hypothesis config profile from `conftest.py`
55+
- HYPOTHESIS_PROFILE='ci'
56+
5457
stages:
5558
# Do the style check and a single test job, don't proceed if it fails
5659
- name: Initial tests

‎conftest.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@
66
import os
77
import tempfile
88

9+
import hypothesis
10+
911
try:
1012
from pytest_astropy_header.display import PYTEST_HEADER_MODULES
1113
except ImportError:
1214
PYTEST_HEADER_MODULES = {}
1315

16+
# Tell Hypothesis that we might be running slow tests, to print the seed blob
17+
# so we can easily reproduce failures from CI, and derive a fuzzing profile
18+
# to try many more inputs. Select profiles with the environment variable.
19+
20+
hypothesis.settings.register_profile('normal', deadline=None)
21+
hypothesis.settings.register_profile('ci', deadline=None, print_blob=True)
22+
hypothesis.settings.register_profile(
23+
'fuzzing', parent=hypothesis.settings.get_profile('ci'), max_examples=10**4
24+
)
25+
hypothesis.settings.load_profile(os.environ.get('HYPOTHESIS_PROFILE', 'normal'))
26+
1427
# Make sure we use temporary directories for the config and cache
1528
# so that the tests are insensitive to local configuration.
1629

0 commit comments

Comments
 (0)