Skip to content

Commit c647de1

Browse files
authored
Maintenance on tests, CI and contributor docs (#468)
* upgrade latest numpy, add previous numpys to tox matrix * simplify requirements using environment markers * tweak environment markers * no npy117 for py27 * upgrade pinnings * try upgrading build image * appveyor thrash * numpy 1.16 on py27 * numpy 1.16 on py27 * test with less numpys * downgrade to try if solves emulator compat * tidy up tox [ci skip] * release notes [ci skip] * remove requirements.txt, not needed * remove requirements.txt, not needed * rework requirements so easier to run tests without services * fix pyup config * use doctestplus * use pytest-remotedata * pytest 5 not on py27 * deal with numpy argument change in unravel_index * deal with packages not on py27 * rework running of service tests using environment variables * use global variables for travis * update pyup * update pyup
1 parent 10ba9a9 commit c647de1

18 files changed

+188
-185
lines changed

.pyup.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@
44
schedule: every month
55

66
requirements:
7-
- requirements.txt:
8-
pin: False
9-
update: False
10-
- requirements_test.txt:
11-
pin: False
12-
update: False
13-
- requirements_rtfd.txt:
14-
pin: False
15-
update: False
16-
- requirements_dev.txt:
7+
- requirements_dev_minimal.txt:
178
pin: True
189
update: all
19-
- requirements_dev_npy.txt:
10+
- requirements_dev_numpy.txt:
2011
pin: True
2112
update: all
2213
- requirements_dev_optional.txt:
2314
pin: True
2415
update: all
16+
- requirements_rtfd.txt:
17+
pin: False
18+
update: False

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ addons:
1111
packages:
1212
- libdb-dev
1313

14+
env:
15+
global:
16+
- ZARR_TEST_ABS=1
17+
- ZARR_TEST_MONGO=1
18+
- ZARR_TEST_REDIS=1
19+
1420
services:
1521
- docker
1622
- redis-server

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ environment:
1414
# See: http://stackoverflow.com/a/13751649/163740
1515
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\build.cmd"
1616
EMULATOR_LOC: C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\Storage Emulator\\AzureStorageEmulator.exe
17+
ZARR_TEST_ABS: 1
1718

1819
matrix:
1920

@@ -33,16 +34,15 @@ environment:
3334
install:
3435
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
3536
- "%CMD_IN_ENV% python -m pip install -U pip setuptools wheel"
36-
- "%CMD_IN_ENV% python -m pip install -rrequirements_test.txt"
37-
- "%CMD_IN_ENV% python -m pip install -rrequirements_dev_npy.txt"
38-
- "%CMD_IN_ENV% python -m pip install --no-binary=numcodecs -rrequirements_dev.txt"
37+
- "%CMD_IN_ENV% python -m pip install -r requirements_dev_numpy.txt -r requirements_dev_minimal.txt -r requirements_dev_optional.txt"
3938
- "%CMD_IN_ENV% python setup.py install"
4039
- "%CMD_IN_ENV% python -m pip freeze"
4140

4241
build: off
4342

4443
before_test:
4544
- '"%EMULATOR_LOC%" start'
45+
- '"%EMULATOR_LOC%" status'
4646

4747
test_script:
4848
- "%CMD_IN_ENV% python -m pytest -v --pyargs zarr"

docs/contributing.rst

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ you have cloned the Zarr source code and your current working directory is the r
9090
the repository, you can do something like the following::
9191

9292
$ mkdir -p ~/pyenv/zarr-dev
93-
$ virtualenv --no-site-packages --python=/usr/bin/python3.6 ~/pyenv/zarr-dev
93+
$ virtualenv --no-site-packages --python=/usr/bin/python3.7 ~/pyenv/zarr-dev
9494
$ source ~/pyenv/zarr-dev/bin/activate
95-
$ pip install -r requirements_dev.txt
96-
$ pip install -r requirements_dev_optional.txt
95+
$ pip install -r requirements_dev_minimal.txt -r requirements_dev_numpy.txt
9796
$ pip install -e .
9897

9998
To verify that your development environment is working, you can run the unit tests::
@@ -139,34 +138,44 @@ Again, any conflicts need to be resolved before submitting a pull request.
139138
Running the test suite
140139
~~~~~~~~~~~~~~~~~~~~~~
141140

142-
Zarr includes a suite of unit tests, as well as doctests included in function and class
143-
docstrings and in the tutorial and storage spec. The simplest way to run the unit tests
144-
is to invoke::
141+
Zarr includes a suite of unit tests, as well as doctests included in
142+
function and class docstrings and in the tutorial and storage
143+
spec. The simplest way to run the unit tests is to activate your
144+
development environment (see `creating a development environment`_ above)
145+
and invoke::
145146

146147
$ pytest -v zarr
147148

148-
To also run the doctests within docstrings, run::
149-
150-
$ pytest -v --doctest-modules zarr
149+
Some tests require optional dependencies to be installed, otherwise
150+
the tests will be skipped. To install all optional dependencies, run::
151151

152-
To run the doctests within the tutorial and storage spec, run::
152+
$ pip install -r requirements_dev_optional.txt
153153

154-
$ python -m doctest -o NORMALIZE_WHITESPACE -o ELLIPSIS docs/tutorial.rst docs/spec/v2.rst
154+
To also run the doctests within docstrings (requires optional
155+
depencies to be installed), run::
155156

156-
Tests can be run under different Python versions using tox. E.g. (assuming you have the
157-
corresponding Python interpreters installed on your system)::
157+
$ pytest -v --doctest-plus zarr
158158

159-
$ tox -e py27,py34,py35,py36
159+
To run the doctests within the tutorial and storage spec (requires
160+
optional dependencies to be installed), run::
160161

161-
Zarr currently supports Python 2.7 and Python 3.4-3.6, so the above command must
162-
succeed before code can be accepted into the main code base. Note that only the py36
163-
tox environment runs the doctests, i.e., doctests only need to succeed under Python 3.6.
162+
$ python -m doctest -o NORMALIZE_WHITESPACE -o ELLIPSIS docs/tutorial.rst docs/spec/v2.rst
164163

165-
All tests are automatically run via Travis (Linux) and AppVeyor (Windows) continuous
166-
integration services for every pull request. Tests must pass under both services before
167-
code can be accepted. Test coverage is also collected automatically via the Coveralls
168-
service, and total coverage over all builds must be 100% (although individual builds
169-
may be lower due to Python 2/3 or other differences).
164+
Note that some tests also require storage services to be running
165+
locally. To run the Azure Blob Service storage tests, run an Azure
166+
storage emulator (e.g., azurite) and set the environment variable
167+
``ZARR_TEST_ABS=1``. To run the Mongo DB storage tests, run a Mongo
168+
server locally and set the environment variable ``ZARR_TEST_MONGO=1``.
169+
To run the Redis storage tests, run a Redis server locally on port
170+
6379 and set the environment variable ``ZARR_TEST_REDIS=1``.
171+
172+
All tests are automatically run via Travis (Linux) and AppVeyor
173+
(Windows) continuous integration services for every pull
174+
request. Tests must pass under both Travis and Appveyor before code
175+
can be accepted. Test coverage is also collected automatically via the
176+
Coveralls service, and total coverage over all builds must be 100%
177+
(although individual builds may be lower due to Python 2/3 or other
178+
differences).
170179

171180
Code standards
172181
~~~~~~~~~~~~~~
@@ -177,8 +186,6 @@ Conformance can be checked by running::
177186

178187
$ flake8 --max-line-length=100 zarr
179188

180-
This is automatically run when invoking ``tox -e py36``.
181-
182189
Test coverage
183190
~~~~~~~~~~~~~
184191

@@ -195,10 +202,15 @@ request. Coveralls coverage must also be 100% before code can be accepted.
195202
Documentation
196203
~~~~~~~~~~~~~
197204

198-
Docstrings for user-facing classes and functions should follow the `numpydoc
199-
<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_ standard,
200-
including sections for Parameters and Examples. All examples should run and pass as doctests
201-
under Python 3.6 only.
205+
Docstrings for user-facing classes and functions should follow the
206+
`numpydoc
207+
<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_
208+
standard, including sections for Parameters and Examples. All examples
209+
should run and pass as doctests under Python 3.7. To run doctests,
210+
activate your development environment, install optional requirements,
211+
and run::
212+
213+
$ pytest -v --doctest-plus zarr
202214

203215
Zarr uses Sphinx for documentation, hosted on readthedocs.org. Documentation is
204216
written in the RestructuredText markup language (.rst files) in the ``docs`` folder.
@@ -208,7 +220,7 @@ folder. Any new features or important usage information should be included in th
208220
tutorial (``docs/tutorial.rst``). Any changes should also be included in the release
209221
notes (``docs/release.rst``).
210222

211-
The documentation can be built by running::
223+
The documentation can be built locally by running::
212224

213225
$ tox -e docs
214226

docs/release.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ Upcoming Release
66

77
* Use uniform chunking for all dimensions when specifying ``chunks`` as an integer.
88
Also adds support for specifying ``-1`` to chunk across an entire dimension.
9-
By :user:`James Bourbeau <jrbourbeau>`; :issue:`456`
9+
By :user:`James Bourbeau <jrbourbeau>`; :issue:`456`.
1010

1111
* Rename ``DictStore`` to ``MemoryStore``.
12-
By :user:`James Bourbeau <jrbourbeau>`; :issue:`455`
12+
By :user:`James Bourbeau <jrbourbeau>`; :issue:`455`.
1313

14+
* Upgrade dependencies in the test matrices and resolve a
15+
compatibility issue with testing against the Azure Storage
16+
Emulator. By :user:`alimanfoo`; :issue:`468`, :issue:`467`.
1417

1518
.. _release_2.3.2:
1619

@@ -21,19 +24,19 @@ Enhancements
2124
~~~~~~~~~~~~
2225

2326
* Use ``scandir`` in ``DirectoryStore``'s ``getsize`` method.
24-
By :user:`John Kirkham <jakirkham>`; :issue:`431`
27+
By :user:`John Kirkham <jakirkham>`; :issue:`431`.
2528

2629
Bug fixes
2730
~~~~~~~~~
2831

2932
* Add and use utility functions to simplify reading and writing JSON.
30-
By :user:`John Kirkham <jakirkham>`; :issue:`429`, :issue:`430`
33+
By :user:`John Kirkham <jakirkham>`; :issue:`429`, :issue:`430`.
3134

3235
* Fix ``collections``'s ``DeprecationWarning``\ s.
33-
By :user:`John Kirkham <jakirkham>`; :issue:`432`
36+
By :user:`John Kirkham <jakirkham>`; :issue:`432`.
3437

3538
* Fix tests on big endian machines.
36-
By :user:`Elliott Sales de Andrade <QuLogic>`; :issue:`427`
39+
By :user:`Elliott Sales de Andrade <QuLogic>`; :issue:`427`.
3740

3841

3942
.. _release_2.3.1:

docs/tutorial.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -806,10 +806,10 @@ The class is :class:`zarr.storage.ABSStore` (requires
806806
`azure-storage-blob <https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python>`_
807807
to be installed)::
808808

809-
>>> store = zarr.ABSStore(container='test', prefix='zarr-testing', blob_service_kwargs={'is_emulated': True})
810-
>>> root = zarr.group(store=store, overwrite=True)
811-
>>> z = root.zeros('foo/bar', shape=(1000, 1000), chunks=(100, 100), dtype='i4')
812-
>>> z[:] = 42
809+
>>> store = zarr.ABSStore(container='test', prefix='zarr-testing', blob_service_kwargs={'is_emulated': True}) # doctest: +SKIP
810+
>>> root = zarr.group(store=store, overwrite=True) # doctest: +SKIP
811+
>>> z = root.zeros('foo/bar', shape=(1000, 1000), chunks=(100, 100), dtype='i4') # doctest: +SKIP
812+
>>> z[:] = 42 # doctest: +SKIP
813813

814814
When using an actual storage account, provide ``account_name`` and
815815
``account_key`` arguments to :class:`zarr.storage.ABSStore`, the

requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

requirements_dev.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

requirements_dev_minimal.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# library requirements
2+
asciitree==0.3.3
3+
fasteners==0.15
4+
numcodecs==0.6.3
5+
msgpack-python==0.5.6
6+
setuptools-scm==3.3.3
7+
# test requirements
8+
pytest==5.0.1; python_version > '3.0'
9+
pytest==4.6.5; python_version < '3.0'
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Break this out into a separate file to allow testing against
22
# different versions of numpy. This file should pin to the latest
33
# numpy version.
4-
numpy==1.15.4
4+
numpy==1.17.0; python_version > '3.0'
5+
numpy==1.16.4; python_version < '3.0'

0 commit comments

Comments
 (0)