Skip to content

Commit

Permalink
add mocked functions to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCaha committed Jan 10, 2025
1 parent 27465e5 commit b6b5912
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,25 @@


@pytest.fixture(autouse=True, scope="function")
def _monkeypatch_iface(qgis_iface, monkeypatch):
def _monkeypatch_iface(qgis_iface: QgisInterface, monkeypatch):
def add_user_input_widget(widget):
pass

qgis_iface.addUserInputWidget = None
monkeypatch.setattr(qgis_iface, "addUserInputWidget", add_user_input_widget)

def push_widget(widget):
pass

qgis_iface.messageBar().pushWidget = None
monkeypatch.setattr(qgis_iface.messageBar(), "pushWidget", push_widget)

def pop_widget():
pass

qgis_iface.messageBar().popWidget = None
monkeypatch.setattr(qgis_iface.messageBar(), "popWidget", pop_widget)


def _raster_layer(path: Path) -> QgsRasterLayer:
layer = QgsRasterLayer(path.as_posix(), path.stem, "gdal")
Expand Down

0 comments on commit b6b5912

Please sign in to comment.