Skip to content

Commit b523439

Browse files
committed
Add hypothesis testing for Time precision
Import hypothesis setup from PR astropy#9211 - If hypothesis ends up fully integrated it should probably be put into pytest-astropy as a dependency, and some of this config should move there. Introduce non-hypothesis example for use in astropy#9579
1 parent 81bff91 commit b523439

6 files changed

Lines changed: 488 additions & 49 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
32bit:
1212
docker:
1313
- image: quay.io/pypa/manylinux1_i686
14+
environment:
15+
HYPOTHESIS_PROFILE: ci
1416
steps:
1517
- checkout
1618
- run:
@@ -20,26 +22,28 @@ jobs:
2022
printf "unicode_output = True\nmax_width = 500" > $HOME/.astropy/config/astropy.cfg
2123
- run:
2224
name: Install dependencies for Python 3.6
23-
command: /opt/python/cp36-cp36m/bin/pip install "numpy<1.17" scipy pytest pytest-astropy pytest-xdist Cython jinja2
25+
command: /opt/python/cp36-cp36m/bin/pip install "numpy<1.17" scipy pytest hypothesis pytest-astropy pytest-xdist Cython jinja2
2426
- run:
2527
name: Run tests for Python 3.6
2628
command: PYTHONHASHSEED=42 /opt/python/cp36-cp36m/bin/python setup.py test --parallel=4 -a "--durations=50"
2729
- run:
2830
name: Install dependencies for Python 3.7
29-
command: /opt/python/cp37-cp37m/bin/pip install "numpy<1.17" scipy pytest pytest-astropy pytest-xdist Cython jinja2 pandas
31+
command: /opt/python/cp37-cp37m/bin/pip install "numpy<1.17" scipy pytest hypothesis pytest-astropy pytest-xdist Cython jinja2 pandas
3032
- run:
3133
name: Run tests for Python 3.7
3234
command: PYTHONHASHSEED=42 /opt/python/cp37-cp37m/bin/python setup.py test --parallel=4 -a "--durations=50"
3335
- run:
3436
name: Install dependencies for Python 3.8
35-
command: /opt/python/cp38-cp38/bin/pip install numpy pytest pytest-astropy pytest-xdist Cython jinja2
37+
command: /opt/python/cp38-cp38/bin/pip install numpy pytest hypothesis pytest-astropy pytest-xdist Cython jinja2
3638
- run:
3739
name: Run tests for Python 3.8
3840
command: PYTHONHASHSEED=42 /opt/python/cp38-cp38/bin/python setup.py test --parallel=4 -a "--durations=50"
3941

4042
image-tests-mpl212:
4143
docker:
4244
- image: astropy/image-tests-py36-mpl212:1.8
45+
environment:
46+
HYPOTHESIS_PROFILE: ci
4347
steps:
4448
- checkout
4549
- run:
@@ -51,6 +55,8 @@ jobs:
5155
image-tests-mpl222:
5256
docker:
5357
- image: astropy/image-tests-py36-mpl222:1.8
58+
environment:
59+
HYPOTHESIS_PROFILE: ci
5460
steps:
5561
- checkout
5662
- run:
@@ -62,6 +68,8 @@ jobs:
6268
image-tests-mpl302:
6369
docker:
6470
- image: astropy/image-tests-py37-mpl302:1.8
71+
environment:
72+
HYPOTHESIS_PROFILE: ci
6573
steps:
6674
- checkout
6775
- run:
@@ -73,6 +81,8 @@ jobs:
7381
image-tests-mpl310:
7482
docker:
7583
- image: astropy/image-tests-py37-mpl311:1.8
84+
environment:
85+
HYPOTHESIS_PROFILE: ci
7686
steps:
7787
- checkout
7888
- run:
@@ -84,6 +94,8 @@ jobs:
8494
image-tests-mpldev:
8595
docker:
8696
- image: astropy/image-tests-py37-base:1.2
97+
environment:
98+
HYPOTHESIS_PROFILE: ci
8799
steps:
88100
- checkout
89101
- run:
@@ -93,7 +105,7 @@ jobs:
93105
apt install -y g++
94106
- run:
95107
name: Install Python dependencies, including developer version of Matplotlib
96-
command: pip3 install pytest pytest-mpl pytest-astropy numpy scipy git+https://github.com/matplotlib/matplotlib.git
108+
command: pip3 install pytest pytest-mpl hypothesis pytest-astropy numpy scipy git+https://github.com/matplotlib/matplotlib.git
97109
- run:
98110
name: Run tests
99111
command: python3 setup.py test -P visualization --remote-data=astropy --open-files -a "--mpl --mpl-results-path=$PWD/results"

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ v
6868

6969
# VSCode
7070
.vscode
71+
72+
# hypothesis
73+
.hypothesis

‎.travis.yml‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ env:
3636
- MAIN_CMD='python setup.py'
3737
- CONDA_DEPENDENCIES='Cython jinja2'
3838
- CONDA_ALL_DEPENDENCIES='Cython jinja2 scipy h5py matplotlib pyyaml pandas pytz html5lib beautifulsoup4 ipython mpmath bleach bottleneck'
39-
- DEV_PIP_DEP='asdf>=2.3 Cython jinja2 scipy h5py matplotlib pyyaml scikit-image pandas pytz html5lib beautifulsoup4 ipython mpmath bleach bottleneck'
39+
- DEV_PIP_DEP='asdf>=2.3 Cython jinja2 scipy h5py matplotlib pyyaml scikit-image pandas pytz html5lib beautifulsoup4 ipython mpmath bleach bottleneck hypothesis'
4040
- ASDF_PIP_DEP='asdf>=2.3'
4141
- SETUP_XVFB=True
4242
- EVENT_TYPE='push pull_request'
@@ -49,6 +49,7 @@ env:
4949
- USE_CI_HELPERS=True
5050
# Use this for the dependencies when not using ci-helpers
5151
- OTHER_DEPENDENCY_PREFERENCES=''
52+
- HYPOTHESIS_PROFILE='ci'
5253

5354
# PEP8 errors/warnings:
5455
# E101 - mix of tabs and spaces
@@ -96,7 +97,7 @@ matrix:
9697
stage: Cron tests
9798
env: SETUP_CMD='test --remote-data=astropy'
9899
CONDA_DEPENDENCIES="$CONDA_ALL_DEPENDENCIES clang"
99-
PIP_DEPENDENCIES="scikit-image jplephem $ASDF_PIP_DEP"
100+
PIP_DEPENDENCIES="scikit-image jplephem hypothesis $ASDF_PIP_DEP"
100101
CCOMPILER=clang
101102
EVENT_TYPE='cron'
102103
DOUBLE_PLAY=True
@@ -108,7 +109,7 @@ matrix:
108109
- os: linux
109110
env: PYTHON_VERSION=3.6 NUMPY_VERSION=1.16
110111
INSTALL_CMD='python setup.py build_ext --inplace'
111-
PIP_DEPENDENCIES='pytest-astropy'
112+
PIP_DEPENDENCIES='pytest-astropy hypothesis'
112113
TEST_CMD='pytest --open-files --doctest-rst'
113114
script:
114115
- $INSTALL_CMD
@@ -128,15 +129,15 @@ matrix:
128129
- os: linux
129130
stage: Initial tests
130131
env: PYTHON_VERSION=3.7 CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
131-
PIP_DEPENDENCIES="scikit-image $ASDF_PIP_DEP"
132+
PIP_DEPENDENCIES="scikit-image hypothesis $ASDF_PIP_DEP"
132133
SETUP_CMD='test -a "--durations=50"'
133134
compiler: clang
134135

135136
# Full tests with coverage checks.
136137
- os: linux
137138
env: SETUP_CMD='test --coverage --remote-data=astropy --readonly'
138139
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
139-
PIP_DEPENDENCIES="scikit-image codecov objgraph jplephem bintrees sortedcontainers $ASDF_PIP_DEP"
140+
PIP_DEPENDENCIES="scikit-image codecov objgraph jplephem bintrees sortedcontainers hypothesis $ASDF_PIP_DEP"
140141
LC_CTYPE=C.ascii LC_ALL=C
141142
CFLAGS='--coverage -fno-inline-functions -O0'
142143
MATPLOTLIB_VERSION=2.1
@@ -147,7 +148,7 @@ matrix:
147148
stage: Final tests
148149
env: PYTHON_VERSION=3.7 SETUP_CMD='test --readonly'
149150
CONDA_DEPENDENCIES=""
150-
PIP_DEPENDENCIES="Cython scipy h5py beautifulsoup4 html5lib jinja2 pyyaml matplotlib scikit-image pytz pandas objgraph asdf"
151+
PIP_DEPENDENCIES="Cython scipy h5py beautifulsoup4 html5lib jinja2 pyyaml matplotlib scikit-image pytz pandas objgraph asdf hypothesis"
151152

152153
# Do a PEP8/pyflakes test with flake8
153154
- os: linux

0 commit comments

Comments
 (0)