auth.LoginTest seems to require sites

15 views
Skip to first unread message

Brian

unread,
Jun 9, 2011, 3:44:43 PM6/9/11
to django...@googlegroups.com
Hi,

When I run the unit tests, I get a failure (stack trace below) from django.contrib.auth.tests.views.LoginTest. test_current_site_in_context_after_login calls Site.objects.get_current() which fails because I'm not using that app. If I include it in the list of installed apps, then the test passes. However, then a bunch of the tests that I've written fail; I think that's because they are using fixtures that are not valid with respect to the schema defined the inclusion of sites, but I haven't confirmed this.

The standard apps that I'm using are:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.admin',

Is the test broken or is there something that I'm doing that makes the sites app mandatory?

Thanks for any help you can give,

Brian

=============================================================================

ERROR: test_current_site_in_context_after_login (django.contrib.auth.tests.views.LoginTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/views.py", line 182, in test_current_site_in_context_after_login
    site = Site.objects.get_current()
  File "/usr/lib/pymodules/python2.6/django/contrib/sites/models.py", line 22, in get_current
    current_site = self.get(pk=sid)
  File "/usr/lib/pymodules/python2.6/django/db/models/manager.py", line 132, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 336, in get
    num = len(clone)
  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 81, in __len__
    self._result_cache = list(self.iterator())
  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 269, in iterator
    for row in compiler.results_iter():
  File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 672, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 727, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py", line 200, in execute
    return Database.Cursor.execute(self, query, params)
DatabaseError: no such table: django_site

Brian

unread,
Jun 16, 2011, 6:50:35 PM6/16/11
to django...@googlegroups.com
In case anyone else has the same issue, the problem stopped when I upgraded django from 1.2 to 1.3.
Reply all
Reply to author
Forward
0 new messages