Skip to content

Commit

Permalink
Forcefully register GDAL driver in import command tests
Browse files Browse the repository at this point in the history
To Workaround a Django bug here: https://github.com/django/django/blob/b35adb0909b25a7dafc9212ddedfbf9b29dc05b8/django/contrib/gis/gdal/driver.py#L81-L83

which should be guarded by two separate checks of the driver_count,
not a single combined one.
  • Loading branch information
Steven Day committed Nov 11, 2015
1 parent 66e8f90 commit 4c043c5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mapit/tests/test_import_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
from django.core.management import call_command
from django.conf import settings
from django.utils.six import StringIO
from django.contrib.gis.gdal.prototypes import ds

from ..models import Type, NameType, Area, Generation, Country


class MapitImportTest(TestCase):
"""Test the mapit_import management command"""

def setUp(self):
# Forcefully register a GDAL datasource driver, because Django has a
# bug where it assumes that any existing drivers mean they're all
# available, which doesn't seem to be the case.
if not ds.get_driver_count():
ds.register_all()

def test_loads_kml_files(self):
# Assert no areas in db before
self.assertEqual(Area.objects.count(), 0)
Expand Down

0 comments on commit 4c043c5

Please sign in to comment.