Skip to content

Commit a893caf

Browse files
eroninjapanjwhitlock
authored andcommitted
Close current database connections
Issue #76 pull request #101
1 parent 498d32f commit a893caf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

django_nose/runner.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ def _should_create_database(connection):
440440
# Connections are cached by some backends, if other code has connected
441441
# to the database previously under a different database name the
442442
# cached connection will be used and no exception will be raised.
443-
# Setting to null here solves that problem.
443+
# Avoiding this by closing connections and setting to null
444+
for connection in connections.all():
445+
connection.close()
444446
connection.connection = None
445447
connection.cursor()
446448
except Exception: # TODO: Be more discerning but still DB agnostic.

0 commit comments

Comments
 (0)