summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-24 14:48:49 -0400
committerTim Graham <timograham@gmail.com>2015-09-25 07:15:19 -0400
commit53e89ce2e71411ff9d1c3fd6f2b10d052a4aeace (patch)
treecb35cd2f5858c10650657eeb37e84d5c2ad5be9a /docs/topics
parent7372cdebed19a9d8e5527823c1e6825156babf98 (diff)
Fixed #25451 -- Added advice about organizing tests.
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/testing/advanced.txt1
-rw-r--r--docs/topics/testing/overview.txt12
2 files changed, 12 insertions, 1 deletions
diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt
index e230c2624d..cb309b4946 100644
--- a/docs/topics/testing/advanced.txt
+++ b/docs/topics/testing/advanced.txt
@@ -248,6 +248,7 @@ Advanced features of ``TransactionTestCase``
Using ``reset_sequences = True`` will slow down the test, since the primary
key reset is an relatively expensive database operation.
+.. _testing-reusable-applications:
Using the Django test runner to test reusable applications
==========================================================
diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt
index 06e6172724..3db0c38d9a 100644
--- a/docs/topics/testing/overview.txt
+++ b/docs/topics/testing/overview.txt
@@ -46,6 +46,17 @@ automatically build a test suite out of those test cases, and run that suite.
For more details about :mod:`unittest`, see the Python documentation.
+.. admonition:: Where should the tests live?
+
+ The default :djadmin:`startapp` template creates a ``tests.py`` file in the
+ new application. This might be fine if you only have a few tests, but as
+ your test suite grows you'll likely want to restructure it into a tests
+ package so you can split your tests into different submodules such as
+ ``test_models.py``, ``test_views.py``, ``test_forms.py``, etc. Feel free to
+ pick whatever organizational scheme you like.
+
+ See also :ref:`testing-reusable-applications`.
+
.. warning::
If your tests rely on database access such as creating or querying models,
@@ -60,7 +71,6 @@ For more details about :mod:`unittest`, see the Python documentation.
.. _running-tests:
-
Running tests
=============