summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-11 15:10:58 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-11 15:10:58 +0100
commite654180ce2a11ef4c525497d6c40dc542e16806c (patch)
tree7658f47dfaafe0dd09fe62fd5525e8f6e6a41ba7 /tests
parentf32100939e8ea8a2714e45e22467af5df55c8f33 (diff)
Improved the API of set_autocommit.
Diffstat (limited to 'tests')
-rw-r--r--tests/backends/tests.py12
-rw-r--r--tests/fixtures_model_package/tests.py8
-rw-r--r--tests/fixtures_regress/tests.py4
-rw-r--r--tests/transactions/tests.py6
4 files changed, 15 insertions, 15 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 51acbcb07f..c7f09013d4 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -522,7 +522,7 @@ class FkConstraintsTests(TransactionTestCase):
"""
When constraint checks are disabled, should be able to write bad data without IntegrityErrors.
"""
- transaction.set_autocommit(autocommit=False)
+ transaction.set_autocommit(False)
try:
# Create an Article.
models.Article.objects.create(headline="Test article", pub_date=datetime.datetime(2010, 9, 4), reporter=self.r)
@@ -538,13 +538,13 @@ class FkConstraintsTests(TransactionTestCase):
finally:
transaction.rollback()
finally:
- transaction.set_autocommit(autocommit=True)
+ transaction.set_autocommit(True)
def test_disable_constraint_checks_context_manager(self):
"""
When constraint checks are disabled (using context manager), should be able to write bad data without IntegrityErrors.
"""
- transaction.set_autocommit(autocommit=False)
+ transaction.set_autocommit(False)
try:
# Create an Article.
models.Article.objects.create(headline="Test article", pub_date=datetime.datetime(2010, 9, 4), reporter=self.r)
@@ -559,14 +559,14 @@ class FkConstraintsTests(TransactionTestCase):
finally:
transaction.rollback()
finally:
- transaction.set_autocommit(autocommit=True)
+ transaction.set_autocommit(True)
def test_check_constraints(self):
"""
Constraint checks should raise an IntegrityError when bad data is in the DB.
"""
try:
- transaction.set_autocommit(autocommit=False)
+ transaction.set_autocommit(False)
# Create an Article.
models.Article.objects.create(headline="Test article", pub_date=datetime.datetime(2010, 9, 4), reporter=self.r)
# Retrive it from the DB
@@ -580,7 +580,7 @@ class FkConstraintsTests(TransactionTestCase):
finally:
transaction.rollback()
finally:
- transaction.set_autocommit(autocommit=True)
+ transaction.set_autocommit(True)
class ThreadTests(TestCase):
diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py
index 894a6c7fde..c250f647ce 100644
--- a/tests/fixtures_model_package/tests.py
+++ b/tests/fixtures_model_package/tests.py
@@ -25,7 +25,7 @@ class SampleTestCase(TestCase):
class TestNoInitialDataLoading(TransactionTestCase):
def test_syncdb(self):
- transaction.set_autocommit(autocommit=False)
+ transaction.set_autocommit(False)
try:
Book.objects.all().delete()
@@ -37,7 +37,7 @@ class TestNoInitialDataLoading(TransactionTestCase):
self.assertQuerysetEqual(Book.objects.all(), [])
transaction.rollback()
finally:
- transaction.set_autocommit(autocommit=True)
+ transaction.set_autocommit(True)
def test_flush(self):
@@ -49,7 +49,7 @@ class TestNoInitialDataLoading(TransactionTestCase):
lambda a: a.name
)
- transaction.set_autocommit(autocommit=False)
+ transaction.set_autocommit(False)
try:
management.call_command(
'flush',
@@ -61,7 +61,7 @@ class TestNoInitialDataLoading(TransactionTestCase):
self.assertQuerysetEqual(Book.objects.all(), [])
transaction.rollback()
finally:
- transaction.set_autocommit(autocommit=True)
+ transaction.set_autocommit(True)
class FixtureTestCase(TestCase):
diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
index f965dd81ac..c76056b93a 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -684,8 +684,8 @@ class TestTicket11101(TransactionTestCase):
@skipUnlessDBFeature('supports_transactions')
def test_ticket_11101(self):
"""Test that fixtures can be rolled back (ticket #11101)."""
- transaction.set_autocommit(autocommit=False)
+ transaction.set_autocommit(False)
try:
self.ticket_11101()
finally:
- transaction.set_autocommit(autocommit=True)
+ transaction.set_autocommit(True)
diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py
index 42a78ad4ba..e5a608e583 100644
--- a/tests/transactions/tests.py
+++ b/tests/transactions/tests.py
@@ -269,19 +269,19 @@ class AtomicMergeTests(TransactionTestCase):
class AtomicErrorsTests(TransactionTestCase):
def test_atomic_requires_autocommit(self):
- transaction.set_autocommit(autocommit=False)
+ transaction.set_autocommit(False)
try:
with self.assertRaises(transaction.TransactionManagementError):
with transaction.atomic():
pass
finally:
- transaction.set_autocommit(autocommit=True)
+ transaction.set_autocommit(True)
def test_atomic_prevents_disabling_autocommit(self):
autocommit = transaction.get_autocommit()
with transaction.atomic():
with self.assertRaises(transaction.TransactionManagementError):
- transaction.set_autocommit(autocommit=not autocommit)
+ transaction.set_autocommit(not autocommit)
# Make sure autocommit wasn't changed.
self.assertEqual(connection.autocommit, autocommit)