To reproduce the problem:
1. Create a new project
2. Edit the settings.py this way:
{{{
DATABASES = {
'default': {},
'mysite': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db_mysite.sqlite3'),
}
}
}}}
3. Add a dummy test to yout project, for example:
{{{
from django.test import TestCase
class MyTestCase(TestCase):
def test_pouet(self):
pass
}}}
4. Run python manage.py test
Problem:
It seems Django instantiate a dummy connector for `default` and then calls
not implemented methods on this connector.
I am attaching the output log of the command.
Here is a sample project to reproduce the behaviour:
https://github.com/trecouvr/test_dj_migrate_174.
--
Ticket URL: <https://code.djangoproject.com/ticket/24394>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* component: Uncategorized => Testing framework
* needs_tests: => 0
* keywords: => test
* needs_docs: => 0
* type: Uncategorized => Bug
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:1>
Comment (by knbk):
I've opened a discussion on this on the mailing list:
https://groups.google.com/forum/#!topic/django-developers/VWyP5M7cRyk
I feel this is more a design decision than a bug. The documentation states
that `default` is required but not in which way. A strict interpretation
would conclude that `DATABASES['default'] = {}` is sufficient, but I
personally have always interpreted this as "`default` requires a valid
database configuration".
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:2>
* stage: Unreviewed => Accepted
Comment:
It is indeed a bug, as the documentation on
[https://docs.djangoproject.com/en/1.7/topics/db/multi-db/#defining-your-
databases multi-db setups] explicitly allows this.
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:3>
* status: new => assigned
* owner: nobody => akulakov
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:4>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
I've reviewed the [https://github.com/django/django/pull/4308 pull
request].
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:5>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"e2bfcab065fef4f1c2f32195c74f054991c33151" e2bfcab]:
{{{
#!CommitTicketReference repository=""
revision="e2bfcab065fef4f1c2f32195c74f054991c33151"
Fixed #24394 -- Allowed running tests with empty default dictionary.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:7>
Comment (by Sjord):
I filed a bug for similar behavior in Django 1.9a1: #25504
--
Ticket URL: <https://code.djangoproject.com/ticket/24394#comment:8>