Skip to content

Commit

Permalink
adjust tests to upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jun 29, 2023
1 parent c5f6aaf commit fc54ac9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Mergin/test/test_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class test_help(unittest.TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
start_app()

def test_help_urls(self):
Expand Down
1 change: 1 addition & 0 deletions Mergin/test/test_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class test_packaging(unittest.TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
start_app()

def test_copy_raster(self):
Expand Down
1 change: 1 addition & 0 deletions Mergin/test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
class test_utils(unittest.TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
start_app()

def tearDown(self):
Expand Down
1 change: 1 addition & 0 deletions Mergin/test/test_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
class test_validations(unittest.TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
start_app()

def tearDown(self):
Expand Down
6 changes: 5 additions & 1 deletion Mergin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,11 @@ def update_datasource(layer, new_path):
"""Updates layer datasource, so the layer is loaded from the new location"""
options = QgsDataProvider.ProviderOptions()
options.layerName = layer.name()
if layer.dataProvider().name() == "vectortile":
if layer.dataProvider().name() == "mbtilesvectortiles":
# For 3.31 and master
layer.setDataSource(f"url={new_path}&type=mbtiles", layer.name(), layer.dataProvider().name(), options)
elif layer.dataProvider().name() == "vectortile":
# For 3.22
layer.setDataSource(f"url={new_path}&type=mbtiles", layer.name(), layer.dataProvider().name(), options)
elif layer.dataProvider().name() == "wms":
layer.setDataSource(f"url=file://{new_path}&type=mbtiles", layer.name(), layer.dataProvider().name(), options)
Expand Down

0 comments on commit fc54ac9

Please sign in to comment.