Skip to content

Commit

Permalink
Fixed a test isolation issue. Refs #17062.
Browse files Browse the repository at this point in the history
This test could change settings.DATABASES['default']['TIME_ZONE'] and
didn't restore the previous value.
  • Loading branch information
aaugustin committed Jan 12, 2014
1 parent 9918c11 commit 1c24096
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/backends/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Unit and doctests for specific database backends.
from __future__ import unicode_literals

import copy
import datetime
from decimal import Decimal
import re
Expand Down Expand Up @@ -336,16 +337,18 @@ def cursor(self):
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
Expand Down

0 comments on commit 1c24096

Please sign in to comment.