**The Problem**
_destroy_test_db uses `DROP DATABASE` query, meaning an exception is
thrown if the database doesn't exist
**A possible solution**
destroy_test_db could take an additional optional argument, which if True,
would cause `IF EXISTS` to be used in the query.
--
Ticket URL: <https://code.djangoproject.com/ticket/32376>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
* component: Testing framework => Database layer (models, ORM)
Comment:
> In our test setup we directly call `connection.creation.destroy_test_db`
and the database that's meant to be dropped may or may not exist - the
latter scenario is completely okay and shouldn't fail
It's really unexpected that the database that you want to destroy doesn't
exist, so an exception is desired. You can always handle it in your app,
add a small wrapper, or
[https://docs.djangoproject.com/en/3.1/ref/databases/#subclassing-the-
built-in-database-backends subclass the built-in database backends].
> destroy_test_db could take an additional optional argument, which if
True, would cause IF EXISTS to be used in the query.
This would require a separate logic on SQLite and Oracle, I don't think
it's worth additional complexity. You can start a discussion on
DevelopersMailingList if you don't agree.
--
Ticket URL: <https://code.djangoproject.com/ticket/32376#comment:1>