Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add warning to call django.setup() when running tests outside of manage.py #2419

Closed
wants to merge 1 commit into from

3 participants

@peterlandry

No description provided.

@mjtamlyn
Collaborator

I think this should be added to the earlier script and be run before setup_test_environment. Alternatively, we could make setup_test_environment call setup(), but I don't think that's wise.

Does this have a ticket?

@timgraham
Owner

While this mention might be included in the final patch, we really need proper documentation in ref/applications.txt as noted in the ticket.

@timgraham timgraham closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 docs/topics/testing/advanced.txt
View
9 docs/topics/testing/advanced.txt
@@ -251,6 +251,15 @@ automatically as part of the setup of ``./manage.py test``. You only
need to manually invoke this method if you're not using running your
tests via Django's test runner.
+.. warning::
+
+ While not specific to testing, Django must be initialized when used
+ outside of ``manage.py``
+
+ >>> import django
+ >>> django.setup()
+
+
.. _other-testing-frameworks:
Using different testing frameworks
Something went wrong with that request. Please try again.