﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29461	ogrinspect test_time_field  failure on SpatiaLite	Tim Graham	nobody	"On Ubuntu 18.04, I see this test failure:
{{{
======================================================================
FAIL: test_time_field (gis_tests.inspectapp.tests.OGRInspectTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/media/sf_django/tests/gis_tests/inspectapp/tests.py"", line 137, in test_time_field
    self.assertIn('    f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', model_def)
AssertionError: '    f_decimal = models.DecimalField(max_digits=0, decimal_places=0)' not found in '# This is an auto-generated Django model module created by ogrinspect.\nfrom django.contrib.gis.db import models\n\n\nclass Measurement(models.Model):\n    f_decimal = models.CharField(max_length=0)\n    f_float = models.CharField(max_length=0)\n    f_int = models.IntegerField()\n    f_char = models.CharField(max_length=0)\n    f_date = models.DateField()\n    f_datetime = models.DateTimeField()\n    f_time = models.TimeField()\n    geom = models.PolygonField()'
}}}
Here's a diff that shows the actual results:
{{{ #!diff
diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.py
index 51bb363..c63c841 100644
--- a/tests/gis_tests/inspectapp/tests.py
+++ b/tests/gis_tests/inspectapp/tests.py
@@ -134,12 +134,12 @@ class OGRInspectTest(TestCase):
         ))
 
         # The ordering of model fields might vary depending on several factors (version of GDAL, etc.)
-        self.assertIn('    f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', model_def)
+        self.assertIn('    f_decimal = models.CharField(max_length=0)', model_def)
         self.assertIn('    f_int = models.IntegerField()', model_def)
         self.assertIn('    f_datetime = models.DateTimeField()', model_def)
         self.assertIn('    f_time = models.TimeField()', model_def)
-        self.assertIn('    f_float = models.FloatField()', model_def)
-        self.assertIn('    f_char = models.CharField(max_length=10)', model_def)
+        self.assertIn('    f_float = models.CharField(max_length=0)', model_def)
+        self.assertIn('    f_char = models.CharField(max_length=0)', model_def)
         self.assertIn('    f_date = models.DateField()', model_def)
 
         # Some backends may have srid=-1
}}}

I'm not sure if the test ever ran on SpatiaLite. On older versions of Ubuntu (16.04) the test [https://github.com/django/django/blob/f185d929fa1c0caad8c03fccde899b647d7248c6/tests/gis_tests/inspectapp/tests.py#L124-L125 is skipped]. The original exception that's caught says ""Could not open the datasource at ""file:memorydb_default?mode=memory&cache=shared"""". The behavior changed in GDAL 2.1.0.
"	Bug	closed	GIS	dev	Normal	fixed		Claude Paroz	Accepted	1	0	0	0	0	0
