diff --git a/taggit/migrations/__init__.py b/taggit/migrations/__init__.py index e69de29..c7e346b 100644 --- a/taggit/migrations/__init__.py +++ b/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) diff --git a/tests/tests.py b/tests/tests.py index 888d6a9..0b5f486 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -2,13 +2,13 @@ from __future__ import unicode_literals, absolute_import 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 @@ -560,3 +560,13 @@ class DeconstructTestCase(UnitTestCase): 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])