#22254 closed Cleanup/optimization (fixed)
Testing documentation doesn't make it clear that django.setup() needs to be called with setup_test_environment
Reported by: | Owned by: | ||
---|---|---|---|
Component: | Documentation | Version: | 1.7-alpha-2 |
Severity: | Normal | Keywords: | app-loading |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It's not specific to testing, but it seems that we should mention the necessity of calling django.setup()
in the directions for running tests outside of manage.py
. I've submitted a pull request with a simple documentation change: https://github.com/django/django/pull/2419
This may require some more discussion, though. As mjtamlyn points out, another solution could be to include django.setup()
in setup_test_environment()
. The call to django.setup()
could also be moved into the example for using setup_test_environment()
rather than a warning in its own.
Change History (10)
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 11 years ago
Keywords: | app-loading added |
---|
comment:3 by , 11 years ago
comment:4 by , 11 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
Type: | Uncategorized → Cleanup/optimization |
Yes, it seems like we should enhance the documentation of django.setup()
. There's some mentions of it in the 1.7 release notes and a couple other places like docs/ref/django-admin.txt
and docs/intro/tutorial01.txt
.
comment:5 by , 11 years ago
Owner: | changed from | to
---|---|
Severity: | Normal → Release blocker |
Status: | new → assigned |
Indeed, django.setup() isn't correctly documented. Sorry about that.
comment:6 by , 11 years ago
https://github.com/django/django/pull/2609 documents django.setup(). Can I haz review?
I'm not convinced it's worth duplicating that information wherever setup_test_environment() is useful. If you hit RuntimeError: App registry isn't ready yet.
Google will tell you how to fix it in 10 seconds. I'll let someone else deal with that part if you want to.
comment:7 by , 11 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:8 by , 11 years ago
Has patch: | unset |
---|---|
Owner: | removed |
Severity: | Release blocker → Normal |
Status: | assigned → new |
Triage Stage: | Ready for checkin → Unreviewed |
django.setup()
is now properly documented, so we can re-evaluate if something needs to be done for setup_test_environment()
.
comment:9 by , 11 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Perhaps it would be better to add instructions or information regarding
django.setup()
in https://docs.djangoproject.com/en/dev/ref/applications/, then just make a reference in the testing docs to it in a warning about using django outside of manage.py?