Run GUI tests on Wayland as well

This commit is contained in:
Elliott Sales de Andrade
2024-12-19 05:16:17 -05:00
parent 8b8c357ab9
commit 4271371599
7 changed files with 69 additions and 19 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
From fde31cca645d54c6f019d4882b6fe4e71a6dc946 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 27 Sep 2017 19:35:59 -0400
Subject: [PATCH 1/5] matplotlibrc path search fix
Subject: [PATCH 1/6] matplotlibrc path search fix
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
+1 -1
View File
@@ -1,7 +1,7 @@
From 9421754530479435e21a98d2f549330899ed8d85 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 11 Aug 2023 02:36:06 -0400
Subject: [PATCH 2/5] Unpin NumPy build requirement
Subject: [PATCH 2/6] Unpin NumPy build requirement
This is so high simply to take advantage of the new
backwards-compatibility guarantee in NumPy 1.25, but Fedora will never
@@ -1,7 +1,7 @@
From 283c5005dbbbea1147e539075032d6ec43c88166 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 14 Feb 2020 06:05:42 -0500
Subject: [PATCH 3/5] Set FreeType version to 2.13.1 and update tolerances
Subject: [PATCH 3/6] Set FreeType version to 2.13.1 and update tolerances
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
@@ -1,7 +1,7 @@
From b671c4141dc9692ce8745a4ddb9f6b0b14e5e70f Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 13 Dec 2024 02:03:33 -0500
Subject: [PATCH 4/5] Unpin meson-python build requirement
Subject: [PATCH 4/6] Unpin meson-python build requirement
This is pinned to fix sdists, but we already have one and are building a
wheel, which should be fine.
@@ -1,7 +1,7 @@
From f6ecac5a3c02b32d66acd0fff41e1732d0939f60 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 22 Aug 2022 18:43:28 -0400
Subject: [PATCH 5/5] Use old stride_windows implementation on 32-bit x86
Subject: [PATCH 5/6] Use old stride_windows implementation on 32-bit x86
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
@@ -0,0 +1,41 @@
From 270a3129688827bb53a29a00e6f745e725f24ff4 Mon Sep 17 00:00:00 2001
From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Date: Wed, 4 Dec 2024 08:54:18 +0100
Subject: [PATCH 6/6] Merge pull request #29206 from QuLogic/wayland-tests
Skip more tests on pure-Wayland systems
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/matplotlib/tests/test_backends_interactive.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py
index ca702bc1d9..129c9596cb 100644
--- a/lib/matplotlib/tests/test_backends_interactive.py
+++ b/lib/matplotlib/tests/test_backends_interactive.py
@@ -78,7 +78,10 @@ def _get_available_interactive_backends():
missing = [dep for dep in deps if not importlib.util.find_spec(dep)]
if missing:
reason = "{} cannot be imported".format(", ".join(missing))
- elif env["MPLBACKEND"] == "tkagg" and _is_linux_and_xdisplay_invalid:
+ elif _is_linux_and_xdisplay_invalid and (
+ env["MPLBACKEND"] == "tkagg"
+ # Remove when https://github.com/wxWidgets/Phoenix/pull/2638 is out.
+ or env["MPLBACKEND"].startswith("wx")):
reason = "$DISPLAY is unset"
elif _is_linux_and_display_invalid:
reason = "$DISPLAY and $WAYLAND_DISPLAY are unset"
@@ -452,6 +455,9 @@ def qt5_and_qt6_pairs():
yield pair
+@pytest.mark.skipif(
+ sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
+ reason="$DISPLAY and $WAYLAND_DISPLAY are unset")
@pytest.mark.parametrize('host, mpl', [*qt5_and_qt6_pairs()])
def test_cross_Qt_imports(host, mpl):
try:
--
2.47.0
+23 -14
View File
@@ -64,13 +64,16 @@ Patch1004: 0004-Unpin-meson-python-build-requirement.patch
# https://github.com/matplotlib/matplotlib/pull/21190#issuecomment-1223271888
Patch0001: 0005-Use-old-stride_windows-implementation-on-32-bit-x86.patch
# https://github.com/matplotlib/matplotlib/pull/29206
Patch0002: 0006-Merge-pull-request-29206-from-QuLogic-wayland-tests.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: glibc-langpack-en
BuildRequires: freetype-devel
BuildRequires: libpng-devel
BuildRequires: qhull-devel
BuildRequires: xorg-x11-server-Xvfb
BuildRequires: xwayland-run
BuildRequires: zlib-devel
BuildRequires: ghostscript
@@ -209,6 +212,7 @@ errorcharts, scatterplots, etc, with just a few lines of code.
Summary: Qt5 backend for python3-matplotlib
BuildRequires: python3dist(cairocffi)
BuildRequires: python3dist(pyqt5)
BuildRequires: qt5-qtwayland
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
Requires: python3dist(cairocffi)
Requires: python3dist(pyqt5)
@@ -222,6 +226,7 @@ Summary: Qt6 backend for python3-matplotlib
BuildRequires: python3dist(cairocffi)
BuildRequires: python3dist(pyqt6)
BuildRequires: python3-pyqt6
BuildRequires: qt6-qtwayland
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
Requires: python3dist(cairocffi)
Requires: python3dist(pyqt6)
@@ -368,20 +373,24 @@ export http_proxy=http://127.0.0.1/
k="${k-}${k+ and }not test_invisible_Line_rendering"
# This test is flaky.
k="${k-}${k+ and }not test_form_widget_get_with_datetime_and_date_fields"
%ifarch %{ix86}
# This test won't work due to Xvfb not existing.
k="${k-}${k+ and }not test_cross_Qt_imports"
%endif
# This fixes GTK4 which is missing a dependency for its current default renderer.
GSK_RENDERER=cairo \
MPLCONFIGDIR=$PWD \
%ifnarch %{ix86}
xvfb-run -a -s "-screen 0 640x480x24" \
%endif
env %{pytest} -ra -n auto \
-m 'not network' -k "${k-}" \
--pyargs matplotlib mpl_toolkits.axes_grid1 mpl_toolkits.axisartist mpl_toolkits.mplot3d
env MPLCONFIGDIR=$PWD \
%{pytest} -ra -n auto \
-m 'not network' -k "${k-}" \
--pyargs matplotlib mpl_toolkits.axes_grid1 mpl_toolkits.axisartist mpl_toolkits.mplot3d
# Skip GTK3Cairo tests that are broken in virtual display.
k="${k-}${k+ and }not (test_interactive_thread_safety and gtk3cairo)"
k="${k-}${k+ and }not (test_interactive_timers and gtk3cairo)"
# Run backend tests with Wayland.
wlheadless-run -- env MPLCONFIGDIR=$PWD GDK_BACKEND=wayland QT_QPA_PLATFORM=wayland \
%{pytest} -vra -n auto \
-m 'not network' -k "${k-}" \
--pyargs matplotlib.tests.test_backend_gtk3 matplotlib.tests.test_backend_qt matplotlib.tests.test_backend_tk matplotlib.tests.test_backends_interactive
# Run backend tests with XWayland.
xwfb-run -- env MPLCONFIGDIR=$PWD \
%{pytest} -ra -n auto \
-m 'not network' -k "${k-}" \
--pyargs matplotlib.tests.test_backend_gtk3 matplotlib.tests.test_backend_qt matplotlib.tests.test_backend_tk matplotlib.tests.test_backends_interactive
%endif