summaryrefslogtreecommitdiff
path: root/django/contrib/gis/tests/gis_migrations
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-08-17 19:06:25 +0200
committerClaude Paroz <claude@2xlibre.net>2014-08-19 17:57:01 +0200
commit6295ea0027d808dcc309aa42cc58f6fdf172c3fc (patch)
tree1155058a07ffa089ebd4e587858dfb6528126060 /django/contrib/gis/tests/gis_migrations
parent3569536491f16c9d112959d23cf3c18417063c54 (diff)
downloaddjango-6295ea0027d808dcc309aa42cc58f6fdf172c3fc.tar.gz
Replaced HAS_SPATIAL_DB by testing database feature
Refs #22632. This should be the base for using more database features to exclude specific backends in GIS tests. Thanks Tim Graham for the review.
Diffstat (limited to 'django/contrib/gis/tests/gis_migrations')
-rw-r--r--django/contrib/gis/tests/gis_migrations/test_commands.py10
-rw-r--r--django/contrib/gis/tests/gis_migrations/test_operations.py9
2 files changed, 8 insertions, 11 deletions
diff --git a/django/contrib/gis/tests/gis_migrations/test_commands.py b/django/contrib/gis/tests/gis_migrations/test_commands.py
index e2b4367a6b..404469f7ea 100644
--- a/django/contrib/gis/tests/gis_migrations/test_commands.py
+++ b/django/contrib/gis/tests/gis_migrations/test_commands.py
@@ -1,13 +1,14 @@
from __future__ import unicode_literals
-from unittest import skipUnless
-
-from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.core.management import call_command
from django.db import connection
-from django.test import override_settings, override_system_checks, TransactionTestCase
+from django.test import (
+ override_settings, override_system_checks, skipUnlessDBFeature,
+ TransactionTestCase
+)
+@skipUnlessDBFeature("gis_enabled")
class MigrateTests(TransactionTestCase):
"""
Tests running the migrate command in Geodjango.
@@ -26,7 +27,6 @@ class MigrateTests(TransactionTestCase):
with connection.cursor() as cursor:
self.assertNotIn(table, connection.introspection.get_table_list(cursor))
- @skipUnless(HAS_SPATIAL_DB, "Spatial db is required.")
@override_system_checks([])
@override_settings(MIGRATION_MODULES={"gis": "django.contrib.gis.tests.gis_migrations.migrations"})
def test_migrate_gis(self):
diff --git a/django/contrib/gis/tests/gis_migrations/test_operations.py b/django/contrib/gis/tests/gis_migrations/test_operations.py
index e8163891cb..6db2e2db30 100644
--- a/django/contrib/gis/tests/gis_migrations/test_operations.py
+++ b/django/contrib/gis/tests/gis_migrations/test_operations.py
@@ -1,14 +1,11 @@
from __future__ import unicode_literals
-from unittest import skipUnless
-
-from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.db import connection, migrations, models
from django.db.migrations.migration import Migration
from django.db.migrations.state import ProjectState
-from django.test import TransactionTestCase
+from django.test import skipUnlessDBFeature, TransactionTestCase
-if HAS_SPATIAL_DB:
+if connection.features.gis_enabled:
from django.contrib.gis.db.models import fields
try:
GeometryColumns = connection.ops.geometry_columns()
@@ -17,7 +14,7 @@ if HAS_SPATIAL_DB:
HAS_GEOMETRY_COLUMNS = False
-@skipUnless(HAS_SPATIAL_DB, "Spatial db is required.")
+@skipUnlessDBFeature("gis_enabled")
class OperationTests(TransactionTestCase):
available_apps = ["django.contrib.gis.tests.gis_migrations"]