summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-10-28 10:04:20 -0400
committerTim Graham <timograham@gmail.com>2015-10-28 13:52:33 -0400
commit29955ba341c3691ebf6d416e237f9b0f66bd314b (patch)
tree6a9fde9534d505c335c182960e833cd5f67d00f4
parent65bff161ffab1310719bdee495d1e9b35f838c31 (diff)
downloaddjango-29955ba341c3691ebf6d416e237f9b0f66bd314b.tar.gz
[1.8.x] Made LiveServerTestCase example use StaticLiveServerTestCase.
Backport of 6b5ae92927cb69e8709ab2bb05f6721a7cd37a3c from master
-rw-r--r--docs/topics/testing/tools.txt17
1 files changed, 13 insertions, 4 deletions
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index 70f2444da6..63e0df6c41 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -826,12 +826,21 @@ Python path:
$ pip install selenium
Then, add a ``LiveServerTestCase``-based test to your app's tests module
-(for example: ``myapp/tests.py``). The code for this test may look as follows::
-
- from django.test import LiveServerTestCase
+(for example: ``myapp/tests.py``). For this example, we'll assume you're using
+the :mod:`~django.contrib.staticfiles` app and want to have static files served
+during the execution of your tests similar to what we get at development time
+with ``DEBUG=True``, i.e. without having to collect them using
+:djadmin:`collectstatic`. We'll use
+the :class:`~django.contrib.staticfiles.testing.StaticLiveServerTestCase`
+subclass which provides that functionality. Replace it with
+``django.test.LiveServerTestCase`` if you don't need that.
+
+The code for this test may look as follows::
+
+ from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium.webdriver.firefox.webdriver import WebDriver
- class MySeleniumTests(LiveServerTestCase):
+ class MySeleniumTests(StaticLiveServerTestCase):
fixtures = ['user-data.json']
@classmethod