#27751: Teardown of a PG test database fails if it is an autogenerated test_MYDB
database
-----------------------------------+------------------------------------
Reporter: Cynthia Kiser | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Resolution:
Keywords: database, testing | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Comment (by Cynthia Kiser):
I was wondering if the problem was that Django was trying to drop the
wrong database (e.g. postgres) so I put a print statement in
django.db.backends.base.creation.py and the error is coming from trying to
drop the correct test_X database. I have a sneaking suspicion that despite
the comment in that method, we are actually connecting to text_X before
trying to drop test_X. (The commit that broke this behavior changed the
decorator on _nodb_connection from @cached_property to just @property.)
{{{
def _destroy_test_db(self, test_database_name, verbosity):
"""
Internal implementation - remove the test db tables.
"""
# Remove the test database to clean up after
# ourselves. Connect to the previous database (not the test
database)
# to do so, because it's not allowed to delete a database while
being
# connected to it.
with self.connection._nodb_connection.cursor() as cursor:
# Wait to avoid "database is being accessed by other users"
errors.
time.sleep(1)
print('************* dropping test db {}
********'.format(test_database_name))
cursor.execute("DROP DATABASE %s"
%
self.connection.ops.quote_name(test_database_name))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27751#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/061.d6b40f93a524f114b522363b899db088%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.