Skip to content

Commit

Permalink
Only run migration state test in 1.7 or greater
Browse files Browse the repository at this point in the history
  • Loading branch information
macro1 committed Oct 10, 2014
1 parent 9793a5e commit 827c3b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
'Programming Language :: Python :: 3.3',
"License :: OSI Approved :: BSD License",
],
tests_require=["Django>=1.4", "webtest==2.0.6", "django-webtest==1.7"],
tests_require=["Django>=1.4", "webtest==2.0.6", "django-webtest==1.7",
"unittest2"],
include_package_data=True,
test_suite='runtests.main',
)
5 changes: 4 additions & 1 deletion simple_history/tests/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from __future__ import unicode_literals

from datetime import datetime, timedelta
from unittest2 import skipUnless

import django
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError: # django 1.4 compatibility
from django.contrib.auth.models import User
from django.db.models.loading import get_model
from django.db.migrations import state
from django.test import TestCase
from django.core.files.base import ContentFile

Expand Down Expand Up @@ -471,5 +472,7 @@ def test_string_related(self):
field_object = HistoricalState._meta.get_field_by_name('library_id')[0]
self.assertEqual(field_object.related.model, State)

@skipUnless(django.get_version() >= "1.7", "Requires 1.7 migrations")
def test_state_serialization_of_customfk(self):
from django.db.migrations import state
state.ModelState.from_model(HistoricalCustomFKError)

0 comments on commit 827c3b9

Please sign in to comment.