Open akaihola opened 12 years ago
This issue is still present in django_nose 1.2. A workaround for me is using --noinput as option for the manage.py test command.
Does this still happen in django-nose 1.4?
Unfortunately it still happens, I just reproduced the issue using django_nose 1.4.1 and nose 1.3.7
Thanks for checking. Django 1.7 improved database setup in 1.7, we may be able to lean on that code or learn from them.
I'm running into this using Django 1.10.5 and django-nose 1.4.4.
I've traced it down to runner.py in _should_create_database(connection) where it does "connection.cursor()". The sqlite file doesn't exist before that call and does afterwards.
When specifying an on-disk SQLite database in the
TEST_NAME
database setting, django-nose always asks if the user wants to try deleting it, even if there was no such file.To reproduce, install django-nose 7fd0132090256e752119f90a3d4568203c486f2e and create a new Django project with
django-admin.py startproject
. Do these changes tosettings.py
:Run the tests:
The reason for this behavior seems to be in
django_nose.runner._should_create_database()
. Theconnection.cursor()
line creates a zero-length SQLite file, and laterdjango.db.backends.sqlite3.creation.DatabaseCreation._create_test_db()
finds it and suggests deleting it.If
TEST_NAME
is not specified and Django's default mechanism for generating the test database name is used, everything works as expected.