Skip to content

Commit

Permalink
TST: add & reorder PySide6 + macOS tests; move Qt helpers into this repo
Browse files Browse the repository at this point in the history
  • Loading branch information
dhomeier committed Jul 19, 2024
1 parent d5ffdf2 commit c4a6c1a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ jobs:
- macos: py311-docs-pyqt64
coverage: false
# Test a few configurations on macOS
# Test a few configurations on macOS 12 (Intel) and 14 (ARM)
- macos: py38-test-pyqt514-all
- macos: py310-test-pyqt515
- macos: py311-test-pyqt65
- macos: py311-test-pyqt66
- macos: py312-test-pyqt67
# Test some configurations on Windows
Expand Down Expand Up @@ -98,13 +97,18 @@ jobs:
# PySide6 6.4 failures due to https://github.com/spyder-ide/qtpy/issues/373
# and https://github.com/matplotlib/matplotlib/issues/24155
# PyQt5 / < 6.6 segfaulting under macOS 14 (on arm64) in TestGlueDataDialog or TestLinkEditor
# Python 3.11.0 failing on Windows in test_image.py on
# > assert df.find_factory(fname) is df.img_data
- linux: py310-test-pyside64-skipexitcode
- linux: py311-test-pyside64-skipexitcode
- linux: py311-test-pyside65-skipexitcode
- linux: py312-test-pyside67-skipexitcode
- macos: py310-test-pyside63-skipexitcode
- macos: py311-test-pyside64-skipexitcode
- macos: py312-test-pyside67-skipexitcode
- macos: py310-test-pyqt515
- windows: py310-test-pyside64
- windows: py312-test-pyside66
- windows: py311-test-pyqt515
# Windows docs build
Expand Down
26 changes: 23 additions & 3 deletions glue_qt/tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# Define decorators that can be used for pytest tests

import pytest

from glue.tests.helpers import PYQT5_INSTALLED, PYQT6_INSTALLED, PYSIDE2_INSTALLED, PYSIDE6_INSTALLED
from glue.tests.helpers import make_marker, make_skipper, make_xfailer

PYQT5_INSTALLED, requires_pyqt5 = make_skipper('PyQt5')
PYQT6_INSTALLED, requires_pyqt6 = make_skipper('PyQt6')
PYSIDE2_INSTALLED, requires_pyside2 = make_skipper('PySide2')
PYSIDE6_INSTALLED, requires_pyside6 = make_skipper('PySide6')

PYQT_INSTALLED = PYQT5_INSTALLED or PYQT6_INSTALLED
PYSIDE_INSTALLED = PYSIDE2_INSTALLED or PYSIDE6_INSTALLED
QT_INSTALLED = PYQT_INSTALLED or PYSIDE_INSTALLED

requires_pyqt = pytest.mark.skipif(str(not PYQT5_INSTALLED and not PYQT6_INSTALLED),
requires_pyqt = pytest.mark.skipif(str(not PYQT_INSTALLED),
reason='An installation of PyQt is required')

requires_pyside = pytest.mark.skipif(str(not PYSIDE2_INSTALLED and not PYSIDE6_INSTALLED),
requires_pyside = pytest.mark.skipif(str(not PYSIDE_INSTALLED),
reason='An installation of PySide is required')

requires_qt = pytest.mark.skipif(str(not QT_INSTALLED),
reason='An installation of Qt is required')

PYQT_GT_59, _ = make_skipper('PyQt5', version='5.10')

requires_pyqt_gt_59_or_pyside = pytest.mark.skipif(str(not (PYQT_GT_59 or PYQT6_INSTALLED
or PYSIDE_INSTALLED)),
reason='Requires PyQt > 5.9 or PySide2/6')
4 changes: 2 additions & 2 deletions glue_qt/tests/test_session_back_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pytest
import numpy as np

from glue.tests.helpers import requires_astropy, requires_h5py, requires_qt
from glue_qt.tests.helpers import requires_pyqt
from glue.tests.helpers import requires_astropy, requires_h5py
from glue_qt.tests.helpers import requires_pyqt, requires_qt
from glue.core.component import CoordinateComponent, Component
from glue.core.state import GlueUnSerializer
from glue.core.component_id import PixelComponentID
Expand Down
8 changes: 4 additions & 4 deletions glue_qt/viewers/table/tests/test_data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from qtpy import QtCore, QtGui
from qtpy.QtCore import Qt

from glue_qt.utils import get_qapp, process_events
from glue.core import Data, DataCollection, BaseData
from glue_qt.utils import qt_to_mpl_color
from glue_qt.app import GlueApplication
from glue.core import Data, DataCollection, BaseData
from glue_qt.tests.helpers import requires_pyqt_gt_59_or_pyside
from glue_qt.utils import get_qapp, process_events, qt_to_mpl_color

from ..data_viewer import DataTableModel, TableViewer

Expand Down Expand Up @@ -179,7 +179,6 @@ def press_key(key):
press_key(Qt.Key_Down)

process_events()

indices = selection.selectedRows()

# We make sure that the third row is selected
Expand Down Expand Up @@ -460,6 +459,7 @@ def test_incompatible_subset():
assert refresh2.call_count == 0


@requires_pyqt_gt_59_or_pyside
def test_table_incompatible_attribute():
"""
Regression test for a bug where the table viewer generates an
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{38,39,310,311,312}-{codestyle,test,docs}-{pyqt514,pyqt515,pyside514,pyside515,pyqt63,pyqt64,pyqt66,pyqt67,pyqt65,pyqt63,pyside66}-all-{dev,legacy}
py{38,39,310,311,312}-{codestyle,test,docs}-{pyqt514,pyqt515,pyside514,pyside515,pyqt63,pyqt64,pyqt66,pyqt67,pyqt65,pyqt63,pyside66,pyside67}-all-{dev,legacy}
requires = pip >= 18.0
setuptools >= 30.3.0

Expand Down Expand Up @@ -37,6 +37,9 @@ deps =
pyside515: PySide2==5.15.*
pyside63: PySide6==6.3.*
pyside64: PySide6==6.4.*
pyside65: PySide6==6.5.*
pyside66: PySide6==6.6.*
pyside67: PySide6==6.7.*
dev: git+https://github.com/numpy/numpy
dev: git+https://github.com/astropy/astropy
lts: astropy==5.0.*
Expand Down

0 comments on commit c4a6c1a

Please sign in to comment.