Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intermittent test failures #116

Open
l0b0 opened this issue May 21, 2021 · 0 comments
Open

Fix intermittent test failures #116

l0b0 opened this issue May 21, 2021 · 0 comments

Comments

@l0b0
Copy link
Contributor

l0b0 commented May 21, 2021

Some of the tests assume that QGIS will finish some asynchronous processing by the time the result is needed in the test code, leading to test failures:

======================================================================
ERROR: test_should_filter_wfs_by_map_bbox (test_ldi_integration.UserWorkFlows)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tests_directory/linz-data-importer/tests/test_ldi_integration.py", line 321, in test_should_filter_wfs_by_map_bbox
    self.filter_data_by_map("NZ Primary Parcels")
  File "/tests_directory/linz-data-importer/tests/test_ldi_integration.py", line 474, in filter_data_by_map
    layer = QgsProject.instance().mapLayersByName(layer_name)[0]
IndexError: list index out of range

======================================================================
ERROR: test_importDataset_wfs (test_ldi_plugin.UnitLevel)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tests_directory/linz-data-importer/tests/test_ldi_plugin.py", line 484, in test_importDataset_wfs
    self.assertEqual(self.ldi.layer_title, names[0])
IndexError: list index out of range

======================================================================
FAIL: test_wfs_import (test_ldi_integration.UserWorkFlows)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tests_directory/linz-data-importer/tests/test_ldi_integration.py", line 293, in test_wfs_import
    self.import_service("wfs")
  File "/tests_directory/linz-data-importer/tests/test_ldi_integration.py", line 421, in import_service
    self.assertEqual(len(names), nconfs)
AssertionError: 0 != 1

Instead of relying on the timing of QGIS the tests should poll the state or subscribe to an event stream which eventually results in the given change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant