Skip to content

Commit

Permalink
Update QgisInterface class, refactor and improve tests [#24]
Browse files Browse the repository at this point in the history
  • Loading branch information
Joonalai committed Dec 18, 2023
1 parent dadc2a7 commit f0a76ac
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 312 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ target/
/tests/data/db.gpkg-shm
/tests/data/db.gpkg-wal
/tests/data/*.tif.aux.xml
/Makefile
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

## Fixes

* Make stub QgisInterface and MockMessageBar inherit real interfaces

# Version 2.0.0 (29-11-2023)

## New Features
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
"src/pytest_qgis/pytest_qgis.py"=["PLR2004"] # TODO: Fix magic values. Remove this after.
"src/pytest_qgis/qgis_interface.py" = ["N802", "N803", "N815"]
"src/pytest_qgis/qgis_interface.py" = ["N802", "N803", "N815", "ARG002"]
"src/pytest_qgis/mock_qgis_classes.py" = ["N802", "N803"]
"tests/*" = [
"ANN001",
Expand Down
3 changes: 1 addition & 2 deletions src/pytest_qgis/pytest_qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import pytest
from qgis.core import Qgis, QgsApplication, QgsProject, QgsRectangle, QgsVectorLayer
from qgis.gui import QgisInterface as QgisInterfaceOrig
from qgis.gui import QgsGui, QgsLayerTreeMapCanvasBridge, QgsMapCanvas
from qgis.PyQt import QtCore, QtWidgets, sip
from qgis.PyQt.QtCore import QCoreApplication
Expand Down Expand Up @@ -185,7 +184,7 @@ def qgis_version() -> int:


@pytest.fixture(scope="session")
def qgis_iface() -> QgisInterfaceOrig:
def qgis_iface() -> QgisInterface:
assert _IFACE
return _IFACE

Expand Down
Loading

0 comments on commit f0a76ac

Please sign in to comment.