tests: skip QGIS plugin tests when PyQt6 is unavailable#100
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7e93eac58
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| PyQtCore = import_module("PyQt6.QtCore") | ||
| except ImportError: | ||
| PyQtCore = None |
There was a problem hiding this comment.
Validate all required PyQt6 modules in sentinel
conftest.py skips collecting plugin tests when any of PyQt6.QtCore/QtGui/QtNetwork/QtWidgets fails to import, but this sentinel only checks QtCore. In environments where QtCore imports but another required submodule is missing/broken, pytest qgis_geoagent/tests will report a passing sentinel while silently skipping the actual plugin tests, which can hide a real dependency gap.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR adjusts the qgis_geoagent plugin test suite so environments without PyQt6 don’t fail during collection; instead, pytest will collect a small “dependency sentinel” test that cleanly skips, while PyQt6-enabled environments keep the existing strict QGIS/PyQt shim behavior.
Changes:
- Added a new sentinel test that skips when PyQt6 is unavailable to ensure
pytest qgis_geoagent/testsreports an explicit skip. - Updated
qgis_geoagent/tests/conftest.pyto avoid importing PyQt-backed plugin test modules when PyQt6 imports fail, preventing collection-time failures. - Made installation of the QGIS stub conditional on PyQt6 availability.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| qgis_geoagent/tests/test_pyqt6_dependency.py | Adds a sentinel test to produce a clear skip when PyQt6 is missing. |
| qgis_geoagent/tests/conftest.py | Switches to conditional PyQt6 imports and ignores collecting plugin tests when PyQt6 is unavailable; only installs QGIS stub when PyQt6 is present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
Summary
pytest qgis_geoagent/testsreports a clear skip instead of failing collection or returning no collected tests.Checks
python -m pytest tests -q-> 306 passed, 2 skippedpython -m pytest qgis_geoagent/tests -q-> 1 skippedpython -m pytest -q-> 306 passed, 3 skippedpython -m ruff check qgis_geoagent/tests/conftest.py qgis_geoagent/tests/test_pyqt6_dependency.pypython -m pre_commit run --files qgis_geoagent/tests/conftest.py qgis_geoagent/tests/test_pyqt6_dependency.py