#15850 closed Bug (fixed)
Test runner fails when sites app not installed
Reported by: | adsva | Owned by: | Carl Meyer |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | schmilblick | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I don't have 'sites' in INSTALLED_APPS, and Changeset [16028] seems to break the test runner.
Selected bits from the manage.py test
traceback:
Traceback (most recent call last): ... File ".../django/db/backends/creation.py", line 256, in create_test_db if Site is not None and Site.objects.using(self.connection.alias).count() == 1: File ".../django/db/models/query.py", line 334, in count return self.query.get_count(using=self.db) File ".../django/db/models/sql/query.py", line 401, in get_count number = obj.get_aggregation(using=using)[None] File ".../django/db/models/sql/query.py", line 367, in get_aggregation result = query.get_compiler(using).execute_sql(SINGLE) File ".../django/db/models/sql/compiler.py", line 735, in execute_sql cursor.execute(sql, params) File ".../django/db/backends/sqlite3/base.py", line 226, in execute return Database.Cursor.execute(self, query, params) django.db.utils.DatabaseError: no such table: django_site
I'm wondering if Site = get_model('sites', 'Site')
is really a good way to check if the sites is installed. Looks like as soon as the Sites model is declared it registers itself to be discovered by get_model?
Change History (6)
comment:1 by , 14 years ago
Cc: | added |
---|
comment:2 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In [16053]:
(The changeset message doesn't reference this ticket)
comment:4 by , 14 years ago
Easy pickings: | unset |
---|
This also needs to be fixed in 1.3.X. Backporting the fix for #15866 is not acceptable as a solution, because #15866 is not a regression and the fix is backwards-incompatible (albeit only to private internal API). I've proposed at http://code.djangoproject.com/ticket/15573#comment:8 that the best answer would be to modify the fix for #15573 to check INSTALLED_APPS rather than the return value of get_model - but I'd prefer if someone with access to test on Oracle would make that change.
Yes, I am seeing this problem as well. #15866 is the root cause, so my first approach is going to be fixing that.
Not closing this as duplicate, though, because it would be possible to fix this (by changing r16027) if fixing #15866 turns out to be quite difficult.