#26270: testing framework requires database configuration from lean databaseless project -----------------------------------+---------------------- Reporter: prinsherbert | Owner: nobody Type: Bug | Status: new Component: Testing framework | Version: 1.9 Severity: Normal | Keywords: database Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -----------------------------------+---------------------- Create django project and application and remove some superfluous files:
{{{ django-admin startproject foo cd foo/ django-admin startapp bar rm -rf bar/migrations/ bar/models.py bar/apps.py bar/admin.py foo/wsgi.py }}} Changed the files to look like this: {{{ # foo/settings.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '1234' DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'bar' ] MIDDLEWARE_CLASSES = [] ROOT_URLCONF = 'foo.urls' DATABASES = {} }}} {{{ # foo/urls.py from django.conf.urls import url from bar.views import my_oh_my urlpatterns = [ url(r'^$', my_oh_my), ] }}} {{{ # bar/tests.py from django.test import TestCase class TestFoo(TestCase): def test_foo(self): assert True print('tested!') }}} {{{ # bar/views.py from django.shortcuts import render from django.http.response import HttpResponse def my_oh_my(request): return HttpResponse('my, oh, my!') }}} Both foo and bar have an empty {{{__init__.py}}}. Running this project as a server is fine, however testing it results in this error: {{{ # python3 manage.py test tested! .E ====================================================================== ERROR: test_foo (bar.tests.TestFoo) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/herbert/.local/lib/python3.4/site- packages/django/test/testcases.py", line 217, in __call__ self._post_teardown() File "/home/herbert/.local/lib/python3.4/site- packages/django/test/testcases.py", line 919, in _post_teardown self._fixture_teardown() File "/home/herbert/.local/lib/python3.4/site- packages/django/test/testcases.py", line 1072, in _fixture_teardown return super(TestCase, self)._fixture_teardown() File "/home/herbert/.local/lib/python3.4/site- packages/django/test/testcases.py", line 955, in _fixture_teardown inhibit_post_migrate=inhibit_post_migrate) File "/home/herbert/.local/lib/python3.4/site- packages/django/core/management/__init__.py", line 119, in call_command return command.execute(*args, **defaults) File "/home/herbert/.local/lib/python3.4/site- packages/django/core/management/base.py", line 399, in execute output = self.handle(*args, **options) File "/home/herbert/.local/lib/python3.4/site- packages/django/core/management/commands/flush.py", line 49, in handle allow_cascade=allow_cascade) File "/home/herbert/.local/lib/python3.4/site- packages/django/core/management/sql.py", line 15, in sql_flush tables = connection.introspection.django_table_names(only_existing=True, include_views=False) File "/home/herbert/.local/lib/python3.4/site- packages/django/db/backends/base/introspection.py", line 86, in django_table_names existing_tables = self.table_names(include_views=include_views) File "/home/herbert/.local/lib/python3.4/site- packages/django/db/backends/base/introspection.py", line 56, in table_names with self.connection.cursor() as cursor: File "/home/herbert/.local/lib/python3.4/site- packages/django/db/backends/base/base.py", line 233, in cursor cursor = self.make_cursor(self._cursor()) File "/home/herbert/.local/lib/python3.4/site- packages/django/db/backends/dummy/base.py", line 21, in complain raise ImproperlyConfigured("settings.DATABASES is improperly configured. " django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details. ---------------------------------------------------------------------- Ran 1 test in 0.002s FAILED (errors=1) }}} It states that I need to better configure the DATABASES variable, which I think is not adequate. (django.__version__ == '1.9.2') -- Ticket URL: <https://code.djangoproject.com/ticket/26270> Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/055.d3c01f82f583786f4b511027dfa04770%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.