Skip to content

Commit

Permalink
Do not register new models inside a transaction test case
Browse files Browse the repository at this point in the history
  • Loading branch information
macro1 committed Apr 3, 2015
1 parent 7e97aec commit 71a7627
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions simple_history/tests/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
from __future__ import unicode_literals

from datetime import datetime, timedelta
try:
from unittest import skipUnless
except ImportError:
from unittest2 import skipUnless
import unittest

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 import models
from django.db.models.loading import get_model
from django.db.models.fields.proxy import OrderWrt
Expand All @@ -29,6 +21,16 @@
)
from ..external.models import ExternalModel2, ExternalModel4

try:
from unittest import skipUnless
except ImportError:
from unittest2 import skipUnless
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

today = datetime(2021, 1, 1, 10, 0)
tomorrow = today + timedelta(days=1)
yesterday = today - timedelta(days=1)
Expand Down Expand Up @@ -324,7 +326,7 @@ def test_register_custome_records(self):
self.assertEqual(expected, str(voter.history.all()[0])[:len(expected)])


class CreateHistoryModelTests(TestCase):
class CreateHistoryModelTests(unittest.TestCase):

def test_create_history_model_with_one_to_one_field_to_integer_field(self):
records = HistoricalRecords()
Expand Down

0 comments on commit 71a7627

Please sign in to comment.