mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
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:
committed by
Tim Abbott
parent
b405780561
commit
d0b40cd7a3
@@ -227,18 +227,6 @@ def run_subsuite(args: SubsuiteArgs) -> Tuple[int, Any]:
|
|||||||
process_instrumented_calls(partial(result.addInstrumentation, None))
|
process_instrumented_calls(partial(result.addInstrumentation, None))
|
||||||
return subsuite_index, result.events
|
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:
|
def destroy_test_databases(worker_id: Optional[int]=None) -> None:
|
||||||
for alias in connections:
|
for alias in connections:
|
||||||
connection = connections[alias]
|
connection = connections[alias]
|
||||||
|
|||||||
Reference in New Issue
Block a user