Skip to content

Commit dfbbb42

Browse files
jaimebarranclaude
andcommitted
CI: install the Qt libraries explicitly, fix the grid test for napari < 0.10
CI has failed since ubuntu-latest moved to Ubuntu 26.04: the apt step of tlambert03/setup-qt-libs fails there. The workflow now installs the same Qt/Mesa/xvfb libraries as the Dockerfile and runs the unit tests under xvfb-run. On Python 3.10 (napari 0.7, the last version for 3.10) test_show_image_napari failed: GridCanvas.position takes the number of layers there, the layers themselves from napari 0.10 on. The test now passes what the installed version expects; monalisa's code was not affected. Also actions/checkout v5 and setup-python v6 (Node 24; Node 20 is deprecated on the runners). Checked with the CI steps in ubuntu:24.04 and ubuntu:26.04 containers, Python 3.10 and 3.12: ruff clean, 41 unit tests passed in each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Srr5jWU9MbszvfGjRefpX
1 parent b4e846c commit dfbbb42

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,30 @@ jobs:
1515
test:
1616
name: Lint and unit tests (no MATLAB)
1717
runs-on: ubuntu-latest
18-
env:
19-
QT_QPA_PLATFORM: offscreen
2018
strategy:
19+
fail-fast: false
2120
matrix:
2221
python-version: ["3.10", "3.12"]
2322
steps:
24-
- uses: actions/checkout@v4
25-
- uses: actions/setup-python@v5
23+
- uses: actions/checkout@v5
24+
- uses: actions/setup-python@v6
2625
with:
2726
python-version: ${{ matrix.python-version }}
28-
- uses: tlambert03/setup-qt-libs@v1 # system libraries for Qt (napari, dialogs)
27+
# System libraries of Qt and Mesa's OpenGL (napari, dialogs) and a virtual display, as in
28+
# the Dockerfile; checked on Ubuntu 24.04 and 26.04.
29+
- name: Qt system libraries
30+
run: |
31+
sudo apt-get update -q
32+
sudo apt-get install -y -q --no-install-recommends \
33+
xvfb xauth libgl1 libegl1 libegl-mesa0 libopengl0 libglx-mesa0 libgl1-mesa-dri \
34+
libglib2.0-0t64 libfontconfig1 libfreetype6 libdbus-1-3 \
35+
libx11-6 libx11-xcb1 libxext6 libxrender1 libxi6 libxkbcommon0 libxkbcommon-x11-0 \
36+
libxcb1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \
37+
libxcb-render-util0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 \
38+
libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1
2939
- run: pip install -e ".[dev]" scikit-image h5py
3040
- run: ruff check src tests examples tools demo
31-
- run: pytest tests/unit -q
41+
- run: xvfb-run -a pytest tests/unit -q
3242

3343
parity:
3444
name: MATLAB parity (static2d)
@@ -37,8 +47,8 @@ jobs:
3747
env:
3848
UPSTREAM_COMMIT: 0cb5cf93c699870bcd93a00b2e2cd787bef73fcc
3949
steps:
40-
- uses: actions/checkout@v4
41-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
51+
- uses: actions/checkout@v5
4252
with:
4353
repository: MattechLab/monalisa
4454
ref: ${{ env.UPSTREAM_COMMIT }}
@@ -54,7 +64,7 @@ jobs:
5464
uses: matlab-actions/run-command@v2
5565
with:
5666
command: addpath('tools/matlab_capture'); run_capture('static2d', fullfile(pwd,'fixtures','matlab'), fullfile(pwd,'upstream'), 'maxBytes', 20e6)
57-
- uses: actions/setup-python@v5
67+
- uses: actions/setup-python@v6
5868
with:
5969
python-version: "3.12"
6070
- run: pip install -e ".[dev]" scikit-image h5py

‎tests/unit/test_imdisp.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Viewer and interactive dialogs, driven programmatically (off-screen Qt)."""
22

3+
import inspect
34
import os
45

56
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
@@ -65,7 +66,10 @@ def test_show_image_napari(qtbot):
6566
ml.show_image(x + 1, viewer=viewer, name="x2") # added to the window: side by side, in order
6667
assert _grid(viewer).enabled
6768
ml.show_image(x - 1, viewer=viewer, name="x3")
68-
assert [_grid(viewer).position(i, viewer.layers) for i in range(3)] == [(0, 0), (0, 1), (0, 2)]
69+
grid = _grid(viewer)
70+
# napari >= 0.10 takes the layers, earlier versions (the last ones for Python 3.10) their number
71+
layers = viewer.layers if "layers" in inspect.signature(grid.position).parameters else len(viewer.layers)
72+
assert [grid.position(i, layers) for i in range(3)] == [(0, 0), (0, 1), (0, 2)]
6973
assert viewer.title == "x | x2 | x3"
7074
finally:
7175
viewer.close()

0 commit comments

Comments
 (0)