Commits

Anonymous committed 8b7e27b

make tests compatible with Django 1.2

  • Participants
  • Parent commits 4287fb4

Comments (0)

Files changed (2)

tests/runtests.py

 
 os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
 
-from django.test.utils import get_runner
-from django.conf import settings
+from django.test.simple import run_tests
 
 def runtests():
-    test_runner = get_runner(settings)
-    failures = test_runner(['tests'], verbosity=1, interactive=True)
+    failures = run_tests(['tests'], verbosity=1, interactive=True)
     sys.exit(failures)
 
 if __name__ == '__main__':
 from django.template import Template, Context, get_library
 from django.test import TestCase, Client
 from django.conf import settings as django_settings
-from django.templatetags.markitup_tags import _get_markitup_context
+from markitup.templatetags.markitup_tags import _get_markitup_context
 from django.core import serializers
 from django.forms.models import modelform_factory
 from django.db.models.fields import FieldDoesNotExist
+from django import VERSION
 
 from django.contrib import admin
 
 
     def tearDown(self):
         settings.MARKITUP_AUTO_PREVIEW = self._old_auto
-    
+
+# format of arg to get_library changed in 1.2
+if VERSION < (1,2):
+    markitup_tags = 'django.templatetags.markitup_tags'
+else:
+    markitup_tags = 'markitup_tags'
 
 class TemplatetagMediaUrlTests(MIUTestCase):
     prefix = '/media'
     # templatetag methods
     def _reset_context(self):
         # monkeypatch a forced recalculation of the template context
-        tags = get_library('django.templatetags.markitup_tags')
+        # format of get_library arg changed in 1.2
+        
+        tags = get_library(markitup_tags)
         tags._markitup_context = _get_markitup_context()
 
     multiple_newlines_re = re.compile('\n+')