Skip to content

Commit cd59796

Browse files
committed
Keep Qt guards skipping when PySide6 imports but its libs are missing
pytest 9.1 changed `importorskip`'s default `exc_type` from ImportError to ModuleNotFoundError, so the container — which has PySide6 installed but no libEGL — turned 16 previously skipped GUI modules into collection errors. Ask for the old behaviour explicitly on the Qt guards. Also move the workflow NOSONAR justifications onto the flagged lines; a comment on the preceding line does not suppress githubactions:S8544.
1 parent b836670 commit cd59796

19 files changed

Lines changed: 19 additions & 21 deletions

.github/workflows/platform-smoke.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ jobs:
2222
- uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
25-
# NOSONAR githubactions:S8544 # reason: installs the checked-out project itself, there is no upstream version to lock
26-
- run: python -m pip install -e .
25+
- run: python -m pip install -e . # NOSONAR githubactions:S8544 # reason: installs the checked-out project itself, there is no upstream version to lock
2726
# The X11 backend connects to a display at import time, so Linux
2827
# runs need a virtual one.
2928
- name: Install a virtual display (Linux)

.github/workflows/quality.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ jobs:
110110
- uses: actions/setup-python@v5
111111
with:
112112
python-version: "3.12"
113-
# NOSONAR githubactions:S8544 # reason: installs the checked-out project itself, there is no upstream version to lock
114-
- run: pip install -e .
113+
- run: pip install -e . # NOSONAR githubactions:S8541,githubactions:S8544 # reason: installs the checked-out project itself, there is no upstream version to lock and the build must run
115114
- run: "pip install --only-binary :all: mypy==2.3.0"
116115
- run: mypy je_auto_control/api je_auto_control/utils/failure_bundle

test/unit_test/headless/test_actions_menu_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import pytest
1616

17-
pytest.importorskip("PySide6.QtWidgets")
17+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
1818

1919
_PROBE = r"""
2020
import json

test/unit_test/headless/test_admin_console_thumbnails_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
9-
pytest.importorskip("PySide6.QtWidgets")
9+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
1010

1111
from PySide6.QtWidgets import QApplication # noqa: E402
1212

test/unit_test/headless/test_audit_log_tab_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# webrtc_panel → aiortc). Only the helper function in the same module
1111
# is pure; gate the whole module on Qt + the webrtc extra to keep the
1212
# import chain happy.
13-
pytest.importorskip("PySide6.QtWidgets")
13+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
1414
pytest.importorskip("av")
1515
pytest.importorskip("aiortc")
1616

test/unit_test/headless/test_qa_tabs_b_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
pytest.importorskip("PySide6.QtWidgets")
6+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
77

88
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
99

test/unit_test/headless/test_qa_tabs_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
pytest.importorskip("PySide6.QtWidgets")
6+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
77

88
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
99

test/unit_test/headless/test_r3_gui_main_window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytest
1111

1212
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
13-
pytest.importorskip("PySide6.QtWidgets")
13+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
1414
# main_window imports qt_material (the theme); the headless CI job installs
1515
# PySide6 but not the GUI theme extra, so skip cleanly there rather than erroring
1616
# out collection for the whole suite.

test/unit_test/headless/test_r3_gui_script_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pytest
1515

1616
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
17-
pytest.importorskip("PySide6.QtWidgets")
17+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
1818

1919
from PySide6.QtWidgets import QAbstractItemView, QApplication # noqa: E402
2020

test/unit_test/headless/test_r3_gui_slot_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import pytest
1818

1919
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
20-
pytest.importorskip("PySide6.QtWidgets")
20+
pytest.importorskip("PySide6.QtWidgets", exc_type=ImportError)
2121

2222
from je_auto_control.utils.exception.exceptions import ( # noqa: E402
2323
AutoControlExecuteActionException, AutoControlHTMLException,

0 commit comments

Comments
 (0)