From 22dc09669299a4c24d45b9201c6bf346cd276974 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Mon, 21 Nov 2016 22:07:52 +0100 Subject: [PATCH] Enable WFS test with a fix to prevent crash on exit (#3774) * Revert "Disable failing PyQgsOfflineEditingWFS test" This reverts commit 33ee514b5dfdc1b57558cb9007df5b455a59fc17. * Let lifetime of layers be controlled by QGIS --- ci/travis/linux/script.sh | 2 +- tests/src/python/test_offline_editing_wfs.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ci/travis/linux/script.sh b/ci/travis/linux/script.sh index 8fa3ad27078d..977e70b84f36 100755 --- a/ci/travis/linux/script.sh +++ b/ci/travis/linux/script.sh @@ -25,5 +25,5 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export OTB_APPLICATION_PATH=${HOME}/OTB-5.6.0-Linux64/lib/otb/applications export LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so -xvfb-run ctest -V -E "qgis_filedownloader|qgis_openstreetmaptest|qgis_wcsprovidertest|PyQgsWFSProviderGUI|PyQgsOfflineEditingWFS|qgis_ziplayertest|$(cat ${DIR}/blacklist.txt | paste -sd '|' -)" -S ./qgis-test-travis.ctest --output-on-failure +xvfb-run ctest -V -E "qgis_filedownloader|qgis_openstreetmaptest|qgis_wcsprovidertest|PyQgsWFSProviderGUI|qgis_ziplayertest|$(cat ${DIR}/blacklist.txt | paste -sd '|' -)" -S ./qgis-test-travis.ctest --output-on-failure # xvfb-run ctest -V -E "qgis_openstreetmaptest|qgis_wcsprovidertest" -S ./qgis-test-travis.ctest --output-on-failure diff --git a/tests/src/python/test_offline_editing_wfs.py b/tests/src/python/test_offline_editing_wfs.py index 8c58df9e78bc..771885ba516d 100644 --- a/tests/src/python/test_offline_editing_wfs.py +++ b/tests/src/python/test_offline_editing_wfs.py @@ -37,7 +37,11 @@ import tempfile from time import sleep from utilities import unitTestDataPath, waitServer -from qgis.core import QgsVectorLayer +from qgis.core import ( + QgsVectorLayer, + QgsMapLayerRegistry, + QgsAuthManager +) from qgis.testing import ( start_app, @@ -133,6 +137,7 @@ def _getOnlineLayer(self, type_name, layer_name=None): self.counter += 1 uri = ' '.join([("%s='%s'" % (k, v)) for k, v in list(parms.items())]) wfs_layer = QgsVectorLayer(uri, layer_name, 'WFS') + wfs_layer.setParent(QgsAuthManager.instance()) assert wfs_layer.isValid() return wfs_layer @@ -143,6 +148,7 @@ def _getLayer(cls, layer_name): """ path = cls.testdata_path + layer_name + '.shp' layer = QgsVectorLayer(path, layer_name, "ogr") + layer.setParent(QgsAuthManager.instance()) assert layer.isValid() return layer