Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Aug 14, 2024
1 parent d78fe93 commit 9721bac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Test with pytest
working-directory: dynamic_layers
run: |
xvfb-run pytest -v
Expand Down
6 changes: 4 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def test_replacement_feature(self):
project.writeEntry(PLUGIN_SCOPE, PluginProjectProperty.Abstract, f"concat('Abstract ', \"folder\")")
project.writeEntry(PLUGIN_SCOPE, PluginProjectProperty.Title, f"concat('Title ', \"folder\")")

vector = QgsVectorLayer(str(Path(f"fixtures/folder_1/lines_1.geojson")), f"Layer folder_1")
vector = QgsVectorLayer(
str(Path(__file__).parent.joinpath(f"fixtures/folder_1/lines_1.geojson")), f"Layer folder_1")
self.assertTrue(vector.isValid())
project.addMapLayer(vector)

Expand Down Expand Up @@ -142,7 +143,8 @@ def test_replacement_variables(self):
project.writeEntry(PLUGIN_SCOPE, PluginProjectProperty.Abstract, f"concat('Abstract ', @x)")
project.writeEntry(PLUGIN_SCOPE, PluginProjectProperty.Title, f"concat('Title ', @x)")

vector = QgsVectorLayer(str(Path(f"fixtures/folder_1/lines_1.geojson")), f"Layer folder_1")
vector = QgsVectorLayer(
str(Path(__file__).parent.joinpath(f"fixtures/folder_1/lines_1.geojson")), f"Layer folder_1")
self.assertTrue(vector.isValid())
project.addMapLayer(vector)

Expand Down
29 changes: 16 additions & 13 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def test_sidecar_files(self):
expected = [side_1, side_2]
expected.sort()
self.assertListEqual(expected, side_car_files(test))

# def test_string_substitution(self):
# """ Test string substitution. """
#
# def test_string_substitution_template(self):
# """ Test string substitution template. """
# self.assertEqual(
# "Hello 1",
# string_substitution(
Expand All @@ -43,13 +43,16 @@ def test_sidecar_files(self):
# is_template=True,
# )
# )
# self.assertEqual(
# "Hello 1",
# string_substitution(
# input_string="concat('Hello ', @here)",
# variables={
# 'here': 1
# },
# is_template=False,
# )
# )
#
# def test_string_substitution_expression(self):
# """ Test string substitution expression. """
# self.assertEqual(
# "Hello 1",
# string_substitution(
# input_string="concat('Hello ', @here)",
# variables={
# 'here': 1
# },
# is_template=False,
# )
# )

0 comments on commit 9721bac

Please sign in to comment.