Skip to content
Permalink
Browse files

Comment Oracle failing test when proj < 7

  • Loading branch information
troopa81 committed Mar 22, 2021
1 parent fe62553 commit 9c6b7e8bd06ac0b8b67267c911ba65c5b04d4cc3
Showing with 23 additions and 4 deletions.
  1. +23 −4 tests/src/python/test_provider_oracle.py
@@ -28,7 +28,8 @@
QgsVectorLayerExporter,
QgsField,
QgsFields,
QgsCoordinateReferenceSystem
QgsCoordinateReferenceSystem,
QgsProjUtils
)

from qgis.PyQt.QtCore import QDate, QTime, QDateTime, QVariant
@@ -188,6 +189,15 @@ def testAddFeatureWrongGeomType(self):
"""
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 @@ def testCreateEmptyLayer(self):
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 @@ def testCreateEmptyLayer(self):
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):
"""

0 comments on commit 9c6b7e8

Please sign in to comment.