Comment Oracle failing test when proj < 7

This commit is contained in:
Julien Cabieces 2021-03-03 17:14:03 +01:00
parent fe62553017
commit 9c6b7e8bd0

View File

@ -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,6 +852,9 @@ 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")
# 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()
@ -864,12 +877,18 @@ 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())
# 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())
# 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):