Skip to content

Commit

Permalink
Merge pull request #338 from dstansby/test-setup
Browse files Browse the repository at this point in the history
Simplify testing setup + Python 3.12 tests
  • Loading branch information
joshmoore authored Feb 6, 2024
2 parents a0ca222 + 9008a55 commit 5a405be
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 72 deletions.
63 changes: 13 additions & 50 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,30 @@ on: [push, pull_request]

jobs:
test:
name: Test ${{ matrix.os }} / ${{ matrix.toxenv }}
name: Test ${{ matrix.os }}-python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: windows-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: windows-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: windows-latest, python_Version: '3.8', toxenv: 'py38'}
- {os: windows-latest, python_Version: '3.9', toxenv: 'py39'}
- {os: ubuntu-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: ubuntu-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: ubuntu-latest, python_Version: '3.8', toxenv: 'py38'}
- {os: ubuntu-latest, python_Version: '3.9', toxenv: 'py39'}
- {os: macos-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: macos-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: macos-latest, python_Version: '3.8', toxenv: 'py38'}
# missing numcodecs wheels on 3.9. conda not yet an option. see gh-51
# {os: macos-latest, python_Version: '3.9', toxenv: 'py39'}

python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python ${{ matrix.python_version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

- name: Install ubuntu libraries
if: startsWith(matrix.os, 'ubuntu')
run: "\
sudo apt-get install -y \
libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 \
libxcb-render-util0 libxcb-xinerama0 \
libxcb-xinput0 libxcb-xfixes0"

- name: Install & test
run: |
python -m pip install tox
tox -e ${{ matrix.toxenv }}
test_coverage:
name: Test coverage
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
name: Install Python '3.10'
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install -r requirements/requirements-dev.txt
- name: Test
run: tox -e 'py310-coverage'
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox --conf tox.ini

- uses: codecov/codecov-action@v2
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
fail_ci_if_error: false
fail_ci_if_error: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ build
dist/
target/
docs/build/

# Testing files
.tox*
.coverage*
coverage.xml
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.8.4 (unreleased)

- Correctly specify maximum compatible fsspec version. ([#338](https://github.com/ome/ome-zarr-py/pull/338))
- Add tests on Python 3.12. ([#338](https://github.com/ome/ome-zarr-py/pull/338))

# 0.8.3 (November 2023)

- Fix reading HCS file on AWS S3 ([#322](https://github.com/ome/ome-zarr-py/pull/322))
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pytest
pytest-cov
codecov
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(fname):
install_requires += (["dask"],)
install_requires += (["distributed"],)
install_requires += (["zarr>=2.8.1"],)
install_requires += (["fsspec[s3]>=0.8,!=2021.07.0,!=2023.09.0"],)
install_requires += (["fsspec[s3]>=0.8,!=2021.07.0"],)
# See https://github.com/fsspec/filesystem_spec/issues/819
install_requires += (["aiohttp<4"],)
install_requires += (["requests"],)
Expand Down
32 changes: 12 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py{38,39,310,311}
envlist = py{38,39,310,311,312}


[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
# passenv = DISPLAY XAUTHORITY
passenv = GITHUB_ACTIONS
deps =
-rrequirements/requirements-dev.txt
pytest-xvfb ; sys_platform == 'linux'

commands =
pytest {posargs:tests -s}
-r requirements/requirements-test.txt

[testenv:py310-coverage]
passenv =
CI
GITHUB_ACTIONS
usedevelop = true
commands =
pytest --cov-report=xml --cov=./ome_zarr --cov-append {posargs:-v}
codecov -f codecov.xml
pytest --cov-report=xml --cov=./ome_zarr --cov-append {posargs}

0 comments on commit 5a405be

Please sign in to comment.