test_runner: Remove _destroy_test_db monkey patch.

This was fixed upstream in Django 1.11.

https://code.djangoproject.com/ticket/27690

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-05-02 01:13:37 -07:00 committed by Tim Abbott
parent b405780561
commit d0b40cd7a3
1 changed files with 0 additions and 12 deletions

View File

@ -227,18 +227,6 @@ def run_subsuite(args: SubsuiteArgs) -> Tuple[int, Any]:
process_instrumented_calls(partial(result.addInstrumentation, None))
return subsuite_index, result.events
# Monkey-patch database creation to fix unnecessary sleep(1)
from django.db.backends.postgresql.creation import DatabaseCreation
def _replacement_destroy_test_db(self: DatabaseCreation,
test_database_name: str,
verbosity: int) -> None:
"""Replacement for Django's _destroy_test_db that removes the
unnecessary sleep(1)."""
with self.connection._nodb_connection.cursor() as cursor:
cursor.execute("DROP DATABASE %s"
% (self.connection.ops.quote_name(test_database_name),))
DatabaseCreation._destroy_test_db = _replacement_destroy_test_db
def destroy_test_databases(worker_id: Optional[int]=None) -> None:
for alias in connections:
connection = connections[alias]