From ffcd7d3350229b796b508bd91bf906959ac83fdb Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Wed, 4 Dec 2024 11:32:27 +0000 Subject: [PATCH] Fix usage of deprecated/removed qApp in test_resize_qt and make sure we run this test in CI --- .github/workflows/main.yml | 9 ++++++++- mpl_scatter_density/tests/test_scatter_density_artist.py | 4 ++-- tox.ini | 7 ++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7603a07..63a7272 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,13 @@ jobs: coverage: codecov runs-on: | linux: ubuntu-latest + display: true + # Linux PyQt 5.15 and 6.x installations require apt-getting xcb and EGL deps + # and headless X11 display + apt: + - '^libxcb.*-dev' + - libxkbcommon-x11-dev + - libegl1-mesa envs: | # Code style - linux: codestyle @@ -21,7 +28,7 @@ jobs: - linux: py39-test-mpl34 - linux: py39-test-mpl35 - linux: py310-test-mpl36 - - linux: py310-test-mpl37 + - linux: py310-test-mpl37-qt - linux: py311-test-mpldev # MacOS X and Windows builds - alternative Matplotlib versions diff --git a/mpl_scatter_density/tests/test_scatter_density_artist.py b/mpl_scatter_density/tests/test_scatter_density_artist.py index 9135f0e..c4228c6 100644 --- a/mpl_scatter_density/tests/test_scatter_density_artist.py +++ b/mpl_scatter_density/tests/test_scatter_density_artist.py @@ -252,7 +252,7 @@ def test_resize_qt(): pytest.importorskip('PyQt5') - from PyQt5.QtWidgets import QMainWindow + from PyQt5.QtWidgets import QMainWindow, QApplication from matplotlib.figure import Figure from matplotlib.backends.backend_qt5 import FigureManagerQT @@ -265,7 +265,7 @@ def test_resize_qt(): canvas.draw = Mock(side_effect=canvas.draw) - from matplotlib.backends.backend_qt5 import qApp + qApp = QApplication.instance() window = QMainWindow() window.setCentralWidget(canvas) diff --git a/tox.ini b/tox.ini index 30b92b7..18020c4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{36,37,38,39,310,311}-test{,-image}{-mpl30,-mpl31,-mpl32,-mpl33,-mpl34,-mpl35,-mpl36,-mpl37,-mpl38,-mpldev} + py{36,37,38,39,310,311}-test{,-image}{-mpl30,-mpl31,-mpl32,-mpl33,-mpl34,-mpl35,-mpl36,-mpl37,-mpl38,-mpldev}{,-qt} codestyle requires = setuptools >= 30.3.0 @@ -8,6 +8,8 @@ requires = isolated_build = true [testenv] +passenv = + DISPLAY setenv = image: MPLFLAGS = --mpl !image: MPLFLAGS = @@ -31,8 +33,11 @@ deps = mpl36: numpy<2 mpl37: matplotlib==3.7.* + mpl38: matplotlib==3.8.* mpldev: matplotlib>=0.0.dev0 + qt: PyQt5 + extras = test