#11987: destroy_test_db can destroy the production database in some situations
-------------------------------+--------------------------------------------
Reporter: eronen | Owner: nobody
Status: new | Milestone:
Component: Testing framework | Version: 1.1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
-------------------------------+--------------------------------------------
I have some tests which need to be run against the production database, so
these test cases temporarily change settings.DATABASE_NAME. If those get
interrupted (by e.g. Control-C) in the wrong place, settings.DATABASE_NAME
might be left pointing to the production database.
Ticket #10868 describes another situation (involving threads) where
destroy_test_db could end up destroying the wrong database.
There might be other reasons why this could happen. I would suggest
rewriting this line in a bit safer way to avoid this ituation. Perhaps
something like this:
{{{
OLD:
test_database_name = settings.DATABASE_NAME
NEW:
if settings.TEST_DATABASE_NAME:
test_database_name = settings.TEST_DATABASE_NAME
elif settings.DATABASE_NAME.startswith(TEST_DATABASE_PREFIX):
test_database_name = settings.DATABASE_NAME
else:
test_database_name = TEST_DATABASE_PREFIX + settings.DATABASE_NAME
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/11987>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---