mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #25329 -- Prevented _nodb_connection from being left open
This commit is contained in:
parent
d3c92afe42
commit
b2f6e421a3
3 changed files with 3 additions and 5 deletions
|
@ -173,12 +173,10 @@ class PostgreSQLTests(TestCase):
|
|||
self.assertIsNone(nodb_conn.settings_dict['NAME'])
|
||||
|
||||
# Now assume the 'postgres' db isn't available
|
||||
del connection._nodb_connection
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
with mock.patch('django.db.backends.base.base.BaseDatabaseWrapper.connect',
|
||||
side_effect=mocked_connect, autospec=True):
|
||||
nodb_conn = connection._nodb_connection
|
||||
del connection._nodb_connection
|
||||
self.assertIsNotNone(nodb_conn.settings_dict['NAME'])
|
||||
self.assertEqual(nodb_conn.settings_dict['NAME'], connection.settings_dict['NAME'])
|
||||
# Check a RuntimeWarning has been emitted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue