Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made sure connections are actually closed in backends tests

  • Loading branch information...
commit 85712a53552a6457c9362b4bf037b1ba6a2e45e1 1 parent 12a96bf
@akaariai akaariai authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 tests/regressiontests/backends/tests.py
View
7 tests/regressiontests/backends/tests.py
@@ -565,6 +565,9 @@ def runner():
# connections[DEFAULT_DB_ALIAS] does.
from django.db import connections
connection = connections[DEFAULT_DB_ALIAS]
+ # Allow thread sharing so the connection can be closed by the
+ # main thread.
+ connection.allow_thread_sharing = True
connection.cursor()
connections_set.add(connection)
for x in range(2):
@@ -579,7 +582,7 @@ def runner():
# connection opened in the main thread will automatically be closed on
# teardown).
for conn in connections_set:
- if conn != connection:
+ if conn is not connection:
conn.close()
def test_connections_thread_local(self):
@@ -606,7 +609,7 @@ def runner():
# connection opened in the main thread will automatically be closed on
# teardown).
for conn in connections_set:
- if conn != connection:
+ if conn is not connection:
conn.close()
def test_pass_connection_between_threads(self):
Please sign in to comment.
Something went wrong with that request. Please try again.