summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-01-12 18:24:04 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-01-12 18:45:45 +0100
commitb79bf9c7a9c1bc0e3cf0c5c4b0d8191a3033530b (patch)
tree34e96e42624a825198f3dce7066dedc9f2dca313
parent6728f159f060e536f1543b4afecb602b6693babb (diff)
[1.6.x] Fixed a test isolation issue. Refs #17062.
This test could change settings.DATABASES['default']['TIME_ZONE'] and didn't restore the previous value. Backport of 1c24096f from master.
-rw-r--r--tests/backends/tests.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 56d47e786e..be0c3a418f 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -2,6 +2,7 @@
# Unit and doctests for specific database backends.
from __future__ import absolute_import, unicode_literals
+import copy
import datetime
from decimal import Decimal
import threading
@@ -315,16 +316,18 @@ class PostgresVersionTest(TestCase):
self.assertEqual(pg_version.get_version(conn), 80300)
-class PostgresNewConnectionTest(TestCase):
- """
- #17062: PostgreSQL shouldn't roll back SET TIME ZONE, even if the first
- transaction is rolled back.
- """
+class PostgresNewConnectionTests(TestCase):
+
@unittest.skipUnless(
connection.vendor == 'postgresql',
"This test applies only to PostgreSQL")
def test_connect_and_rollback(self):
- new_connections = ConnectionHandler(settings.DATABASES)
+ """
+ PostgreSQL shouldn't roll back SET TIME ZONE, even if the first
+ transaction is rolled back (#17062).
+ """
+ databases = copy.deepcopy(settings.DATABASES)
+ new_connections = ConnectionHandler(databases)
new_connection = new_connections[DEFAULT_DB_ALIAS]
try:
# Ensure the database default time zone is different than