Skip to content

Commit

Permalink
Merge pull request #107 from dstansby/clean-gh-actions
Browse files Browse the repository at this point in the history
Clean up GitHub actions config
  • Loading branch information
joshmoore authored Nov 21, 2024
2 parents 2d2e324 + 6b790ed commit 0bf3625
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ name: tests
on:
push:
branches:
- master
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- master
- main
workflow_dispatch:

Expand All @@ -23,26 +21,21 @@ jobs:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

# these libraries, along with pytest-xvfb (added in the `deps` in
# tox.ini), enable testing on Qt on linux
- name: Install Linux libraries
if: runner.os == 'Linux'
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
# these libraries enable testing on Qt on linux
- uses: tlambert03/setup-qt-libs@v1

# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
Expand All @@ -58,16 +51,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools tox tox-gh-actions
python -m pip install tox tox-gh-actions
# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
run: tox
uses: aganders3/headless-gui@v1
with:
run: tox
env:
PLATFORM: ${{ matrix.platform }}

- name: Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false

Expand All @@ -79,9 +74,9 @@ jobs:
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
Expand Down
21 changes: 15 additions & 6 deletions napari_ome_zarr/_tests/test_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from pathlib import Path

import numpy as np
import pytest
Expand All @@ -9,10 +10,18 @@

class TestNapari:
@pytest.fixture(autouse=True)
def initdir(self, tmpdir):
self.path_3d = tmpdir.mkdir("data_3d")
create_zarr(str(self.path_3d), astronaut, "astronaut")
self.path_2d = tmpdir.mkdir("data_2d")
def initdir(self, tmp_path: Path):
"""
Write some temporary test data.
create_zarr() creates an image pyramid and labels zarr directories.
"""
self.path_3d = tmp_path / "data_3d"
self.path_3d.mkdir()
create_zarr(str(self.path_3d), method=astronaut, label_name="astronaut")

self.path_2d = tmp_path / "data_2d"
self.path_2d.mkdir()
create_zarr(str(self.path_2d))

def test_get_reader_hit(self):
Expand Down Expand Up @@ -81,12 +90,12 @@ def test_image(self, path):
self.assert_layers(layers, True, False, path)

def test_labels(self):
filename = str(self.path_3d.join("labels"))
filename = str(self.path_3d / "labels")
layers = napari_get_reader(filename)()
self.assert_layers(layers, False, True)

def test_label(self):
filename = str(self.path_3d.join("labels", "astronaut"))
filename = str(self.path_3d / "labels" / "astronaut")
layers = napari_get_reader(filename)()
self.assert_layers(layers, False, True)

Expand Down

0 comments on commit 0bf3625

Please sign in to comment.