Skip to content

Commit

Permalink
Merge 8e0b823 into 3b9dad7
Browse files Browse the repository at this point in the history
  • Loading branch information
akuchling committed Nov 11, 2016
2 parents 3b9dad7 + 8e0b823 commit 7339ce4
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions django_nose/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ def setUpClass(cls):
raise NotImplementedError('%s supports only DBs with transaction '
'capabilities.' % cls.__name__)
for db in cls._databases():
# These MUST be balanced with one leave_* each:
transaction.enter_transaction_management(using=db)
# Don't commit unless we say so:
transaction.managed(True, using=db)
transaction.set_autocommit(False, using=db)

cls._fixture_setup()

Expand All @@ -59,15 +57,14 @@ def tearDownClass(cls):
for db in cls._databases():
# Finish off any transactions that may have happened in
# tearDownClass in a child method.
if transaction.is_dirty(using=db):
transaction.commit(using=db)
transaction.leave_transaction_management(using=db)
transaction.commit(using=db)

@classmethod
def _fixture_setup(cls):
"""Load fixture data, and commit."""
for db in cls._databases():
if (hasattr(cls, 'fixtures') and
cls.fixtures is not None and
getattr(cls, '_fb_should_setup_fixtures', True)):
# Iff the fixture-bundling test runner tells us we're the first
# suite having these fixtures, set them up:
Expand Down Expand Up @@ -122,8 +119,6 @@ def _pre_setup(self):
cache.cache.clear()
settings.TEMPLATE_DEBUG = settings.DEBUG = False

test.testcases.disable_transaction_methods()

self.client = self.client_class()
# self._fixture_setup()
self._urlconf_setup()
Expand All @@ -142,7 +137,6 @@ def _post_teardown(self):
"""
# Rollback any mutations made by tests:
test.testcases.restore_transaction_methods()
for db in self._databases():
transaction.rollback(using=db)

Expand Down

0 comments on commit 7339ce4

Please sign in to comment.