Skip to content

Commit 685ba06

Browse files
pwolframshoyer
authored andcommitted
Marks slow, flaky, and failing tests (#1336)
* Adds marked tests as slow, flakey, and optionalci Tests are marked using the following py.test options: * @slow which is run on default, not run if `--skip-slow`. * @optionalci is run on default, not run if `--skip-optional-ci` * @flakey which is not run on default, run if `--run-flakey` Note, the `optionalci` category is needed in order to mark tests that are environment dependent when run on continuous integration (CI) hardware, e.g., tests that fail due to variable loads on travis CI. * Spelling: flakey -> flaky * Test suite adjustments * Typos * Remove bottleneck from most CI builds * xfail for cross engine read write netcdf4 * Try fix: Closes open file (for Windows error) ``` WindowsError: [Error 32] The process cannot access the file because it is being used by another process ``` * Try fix: Closes open file (for Windows error) ``` WindowsError: [Error 32] The process cannot access the file because it is being used by another process ```
1 parent d08efaf commit 685ba06

16 files changed

+169
-57
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ matrix:
2020
env: CONDA_ENV=py35
2121
- python: 3.6
2222
env: CONDA_ENV=py36
23+
- python: 3.6
24+
env:
25+
- CONDA_ENV=py36
26+
- EXTRA_FLAGS="--run-flaky"
2327
- python: 3.6
2428
env: CONDA_ENV=py36-pydap
2529
- python: 3.6
@@ -36,6 +40,10 @@ matrix:
3640
- python: 3.6
3741
env: CONDA_ENV=py36-condaforge-rc
3842
allow_failures:
43+
- python: 3.6
44+
env:
45+
- CONDA_ENV=py36
46+
- EXTRA_FLAGS="--run-flaky"
3947
- python: 3.6
4048
env: CONDA_ENV=py36-pydap
4149
- python: 3.6
@@ -76,7 +84,7 @@ install:
7684
- python setup.py install
7785

7886
script:
79-
- py.test xarray --cov=xarray --cov-report term-missing --verbose
87+
- py.test xarray --cov=xarray --cov-report term-missing --verbose $EXTRA_FLAGS
8088

8189
after_success:
8290
- coveralls

ci/requirements-py27-cdat+pynio.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ channels:
44
dependencies:
55
- python=2.7
66
- cdat-lite
7+
- cyordereddict
78
- dask
89
- distributed
9-
- pytest
10+
- h5py
11+
- h5netcdf
12+
- matplotlib
13+
- netcdf4
1014
- numpy
11-
- pandas>=0.15.0
15+
- pandas
1216
- pynio
13-
- netcdf4
17+
- pytest
1418
- scipy
15-
- pytest-cov
16-
- cyordereddict
17-
- h5py
18-
- netcdf4
19-
- matplotlib
2019
- seaborn
20+
- toolz
2121
- pip:
2222
- coveralls
23+
- pytest-cov

ci/requirements-py27-windows.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ channels:
44
dependencies:
55
- python=2.7
66
- dask
7+
- distributed
8+
- h5py
9+
- h5netcdf
710
- matplotlib
8-
- netCDF4
11+
- netcdf4
12+
- pytest
913
- numpy
1014
- pandas
11-
- pip
12-
- pytest
1315
- scipy
16+
- seaborn
17+
- toolz

ci/requirements-py35.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.5
6-
- cython
76
- dask
87
- distributed
98
- h5py
9+
- h5netcdf
1010
- matplotlib
1111
- netcdf4
1212
- pytest
1313
- numpy
1414
- pandas
15-
- seaborn
1615
- scipy
16+
- seaborn
17+
- toolz
1718
- pip:
1819
- coveralls
1920
- pytest-cov
20-
- h5netcdf

ci/requirements-py36-condaforge-rc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ channels:
44
- conda-forge
55
dependencies:
66
- python=3.6
7-
- cython
87
- dask
98
- distributed
109
- h5py
10+
- h5netcdf
1111
- matplotlib
1212
- netcdf4
1313
- pytest
1414
- numpy
1515
- pandas
1616
- seaborn
1717
- scipy
18+
- toolz
1819
- pip:
1920
- coveralls
2021
- pytest-cov
21-
- h5netcdf

ci/requirements-py36-dask-dev.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.6
6-
- cython
6+
- h5py
7+
- h5netcdf
8+
- matplotlib
9+
- netcdf4
710
- pytest
811
- numpy
912
- pandas
13+
- seaborn
1014
- scipy
1115
- toolz
1216
- pip:
1317
- coveralls
1418
- pytest-cov
15-
- git+https://github.com/blaze/dask.git
19+
- git+https://github.com/dask/dask.git
20+
- git+https://github.com/dask/distributed.git

ci/requirements-py36-netcdf4-dev.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ dependencies:
77
- dask
88
- distributed
99
- h5py
10+
- h5netcdf
11+
- matplotlib
1012
- pytest
1113
- numpy
1214
- pandas
1315
- scipy
16+
- toolz
1417
- pip:
1518
- coveralls
1619
- pytest-cov
17-
- h5netcdf
1820
- git+https://github.com/Unidata/netcdf4-python.git

ci/requirements-py36-pandas-dev.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.6
6-
- cython=0.23.4
6+
- cython
7+
- dask
8+
- distributed
9+
- h5py
10+
- h5netcdf
11+
- matplotlib
12+
- netcdf4
713
- pytest
8-
- numpy=1.10.1
9-
- netcdf4=1.1.9
10-
- scipy=0.16.0
14+
- numpy
15+
- scipy
1116
- toolz
1217
- pip:
1318
- coveralls
1419
- pytest-cov
15-
- dask
1620
- git+https://github.com/pydata/pandas.git

ci/requirements-py36-pydap.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ dependencies:
66
- dask
77
- distributed
88
- h5py
9+
- h5netcdf
10+
- matplotlib
911
- netcdf4
1012
- pytest
1113
- numpy
12-
- pandas
1314
- scipy
15+
- toolz
1416
- pip:
1517
- coveralls
1618
- pytest-cov

ci/requirements-py36-windows.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ channels:
44
dependencies:
55
- python=3.6
66
- dask
7+
- distributed
8+
- h5py
9+
- h5netcdf
710
- matplotlib
8-
- netCDF4
11+
- netcdf4
12+
- pytest
913
- numpy
1014
- pandas
11-
- pip
12-
- pytest
1315
- scipy
16+
- seaborn
17+
- toolz

ci/requirements-py36.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.6
6-
- cython
76
- dask
87
- distributed
98
- h5py
9+
- h5netcdf
1010
- matplotlib
1111
- netcdf4
1212
- pytest
1313
- numpy
1414
- pandas
15-
- seaborn
1615
- scipy
16+
- seaborn
17+
- toolz
1718
- pip:
1819
- coveralls
1920
- pytest-cov
20-
- h5netcdf

conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""Configuration for pytest."""
2+
3+
4+
def pytest_addoption(parser):
5+
"""Add command-line flags for pytest."""
6+
parser.addoption("--run-flaky", action="store_true",
7+
help="runs flaky tests")
8+
parser.addoption("--skip-slow", action="store_true",
9+
help="skips slow tests")

doc/whats-new.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ By `Henry S. Harrison <https://hsharrison.github.io>`_.
5050
cleaner output. The full metadata is still available as ``data.attrs``.
5151
By `Zac Hatfield-Dodds <https://github.com/Zac-HD>`_.
5252

53+
- Enhanced tests suite by use of ``@slow`` and ``@flaky`` decorators, which are
54+
controlled via ``--run-flaky`` and ``--skip-slow`` command line arguments
55+
to ``py.test``. By `Stephan Hoyer <https://github.com/shoyer>`_ and
56+
`Phillip J. Wolfram <https://github.com/pwolfram>`_.
57+
5358
Bug fixes
5459
~~~~~~~~~
5560
- ``rolling`` now keeps its original dimension order (:issue:`1125`).

xarray/tests/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ def requires_bottleneck(test):
114114
return test if has_bottleneck else pytest.mark.skip('requires bottleneck')(test)
115115

116116

117+
flaky = pytest.mark.skipif(
118+
not pytest.config.getoption("--run-flaky"),
119+
reason="set --run-flaky option to run flaky tests")
120+
121+
slow = pytest.mark.skipif(
122+
pytest.config.getoption("--skip-slow"),
123+
reason="set --skip-slow option to run slow tests")
124+
125+
117126
class TestCase(unittest.TestCase):
118127
if PY3:
119128
# Python 3 assertCountEqual is roughly equivalent to Python 2

0 commit comments

Comments
 (0)