#15111 closed Uncategorized (fixed)
manage.py test fails if sites app not installed
Reported by: | Waldemar Kornewald | Owned by: | nobody |
---|---|---|---|
Component: | Contrib apps | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The unit tests of several contrib apps depend on the sites app even though the respective contrib app already falls back to RequestSite. The attached patch fixes the failing tests (at least the ones I've stumbled upon). Not sure how this patch relates to the proposed changes in #15089, though.
Attachments (1)
Change History (9)
by , 14 years ago
Attachment: | site_not_installed.diff added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
Marking RFC because the patch is pretty much ready to use.
However, I have a suspicion that the very last delta is wrong (or at least requires additional thought). The call to get_current() is intended to populate a cache; it shouldn't be possible to remove that line without consequences.
comment:2 by , 14 years ago
Maybe if the purpose of the last line is to check if the exception is raised even with the Site cache filled we might need a small extra change. But then I'd rather extend get_current(), so it's guaranteed to raise Site.DoesNotExist if Site._meta.installed is False and have a unit test in the sites app for that.
OTOH, I'd question the whole purpose of testing against a filled cache with Site._meta.installed set to False via a hack because then the unit test would verify if everything works correctly even if people use ugly hacks in their code (i.e., manipulating Site._meta.installed in production code).
comment:3 by , 14 years ago
Cc: | added |
---|
comment:8 by , 13 years ago
Cc: | removed |
---|---|
Easy pickings: | unset |
Severity: | → Normal |
Type: | → Uncategorized |
UI/UX: | unset |
patch against r15239