From 9c6b7e8bd06ac0b8b67267c911ba65c5b04d4cc3 Mon Sep 17 00:00:00 2001 From: Julien Cabieces Date: Wed, 3 Mar 2021 17:14:03 +0100 Subject: [PATCH] Comment Oracle failing test when proj < 7 --- tests/src/python/test_provider_oracle.py | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/src/python/test_provider_oracle.py b/tests/src/python/test_provider_oracle.py index e1a7bef308a..b6c9c58ec7b 100644 --- a/tests/src/python/test_provider_oracle.py +++ b/tests/src/python/test_provider_oracle.py @@ -28,7 +28,8 @@ from qgis.core import ( QgsVectorLayerExporter, QgsField, QgsFields, - QgsCoordinateReferenceSystem + QgsCoordinateReferenceSystem, + QgsProjUtils ) from qgis.PyQt.QtCore import QDate, QTime, QDateTime, QVariant @@ -188,6 +189,15 @@ class TestPyQgsOracleProvider(unittest.TestCase, ProviderTestCase): """ pass + def testCrs(self): + """ + We override this test for Oracle provider, because without PROJ >= 7 + Oracle is not able to understand correctly some EPSG code (4326 for instance) + """ + # TODO remove this when PROJ will be >= 7 + if QgsProjUtils.projVersionMajor() >= 7: + super().testCrs() + # HERE GO THE PROVIDER SPECIFIC TESTS def testDateTimeTypes(self): vl = QgsVectorLayer('%s table="QGIS"."DATE_TIMES" sql=' % @@ -842,7 +852,10 @@ class TestPyQgsOracleProvider(unittest.TestCase, ProviderTestCase): self.assertTrue(query.exec_("SELECT column_name, srid FROM user_sdo_geom_metadata WHERE table_name = 'EMPTY_LAYER'")) self.assertTrue(query.next()) self.assertEqual(query.value(0), "GEOM") - self.assertEqual(query.value(1), 4326) + # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326 + # TODO remove this when PROJ will be >= 7 + if QgsProjUtils.projVersionMajor() >= 7: + self.assertEqual(query.value(1), 4326) query.finish() # no feature, so we cannot guess the geometry type, so the layer is not valid @@ -864,13 +877,19 @@ class TestPyQgsOracleProvider(unittest.TestCase, ProviderTestCase): query = QSqlQuery(self.conn) self.assertTrue(query.exec_('SELECT "l"."GEOM"."SDO_SRID" from "QGIS"."EMPTY_LAYER" "l"')) self.assertTrue(query.next()) - self.assertEqual(query.value(0), 4326) + # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326 + # TODO remove this when PROJ will be >= 7 + if QgsProjUtils.projVersionMajor() >= 7: + self.assertEqual(query.value(0), 4326) query.finish() # now we can autodetect geom type and srid vl = QgsVectorLayer(self.dbconn + ' sslmode=disable table="QGIS"."EMPTY_LAYER" (GEOM) sql=', 'test', 'oracle') self.assertTrue(vl.isValid()) - self.assertEqual(vl.sourceCrs().authid(), "EPSG:4326") + # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326 + # TODO remove this when PROJ will be >= 7 + if QgsProjUtils.projVersionMajor() >= 7: + self.assertEqual(vl.sourceCrs().authid(), "EPSG:4326") def testCreateAspatialLayer(self): """