Skip to content

Commit

Permalink
Merge pull request #222 from treyhunner/south-error-on-import
Browse files Browse the repository at this point in the history
South error on import
  • Loading branch information
apollo13 committed Apr 8, 2014
2 parents 8f055c0 + edb1753 commit f478e34
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
21 changes: 21 additions & 0 deletions taggit/migrations/__init__.py
@@ -0,0 +1,21 @@
"""
Django migrations for taggit app
This package does not contain South migrations. South migrations can be found
in the ``south_migrations`` package.
"""

SOUTH_ERROR_MESSAGE = """\n
For South support, customize the SOUTH_MIGRATION_MODULES setting like so:
SOUTH_MIGRATION_MODULES = {
'taggit': 'taggit.south_migrations',
}
"""

# Ensure the user is not using Django 1.6 or below with South
try:
from django.db import migrations # noqa
except ImportError:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured(SOUTH_ERROR_MESSAGE)
16 changes: 13 additions & 3 deletions tests/tests.py
Expand Up @@ -2,13 +2,13 @@

from unittest import TestCase as UnitTestCase
try:
from unittest import skipIf
from unittest import skipIf, skipUnless
except:
from django.utils.unittest import skipIf
from django.utils.unittest import skipIf, skipUnless

import django
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.core import serializers
from django.db import connection
from django.test import TestCase, TransactionTestCase
Expand Down Expand Up @@ -560,3 +560,13 @@ def test_deconstruct_kwargs_kept(self):
name, path, args, kwargs = instance.deconstruct()
new_instance = TaggableManager(*args, **kwargs)
self.assertEqual(instance.rel.through, new_instance.rel.through)


@skipUnless(django.VERSION < (1, 7), "test only applies to 1.6 and below")
class SouthSupportTests(TestCase):
def test_import_migrations_module(self):
try:
from taggit.migrations import __doc__ # noqa
except ImproperlyConfigured as e:
exception = e
self.assertIn("SOUTH_MIGRATION_MODULES", exception.args[0])

0 comments on commit f478e34

Please sign in to comment.