summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2015-04-16 16:19:30 -0400
committerSimon Charette <charette.s@gmail.com>2015-05-20 12:50:41 -0400
commitc15b0c27927afd141d311dd9bfe68540cf44a8d6 (patch)
treec2c5771a671270b59f05b4bdfbb9b3e76213cbbd /docs
parentead36e8a471389a6032d825c8245245ebb89ea5d (diff)
Fixed #24652 -- Disallowed query execution in SimpleTestCase subclasses.
Thanks to Tim and Anssi for the review.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.9.txt6
-rw-r--r--docs/topics/testing/tools.txt11
2 files changed, 17 insertions, 0 deletions
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt
index 28bd915a23..76e8085fbd 100644
--- a/docs/releases/1.9.txt
+++ b/docs/releases/1.9.txt
@@ -505,6 +505,12 @@ Miscellaneous
* The ``django.contrib.sites.models.Site.domain`` field was changed to be
:attr:`~django.db.models.Field.unique`.
+* In order to enforce test isolation, database queries are not allowed
+ by default in :class:`~django.test.SimpleTestCase` tests anymore. You
+ can disable this behavior by setting the
+ :attr:`~django.test.SimpleTestCase.allow_database_queries` class attribute
+ to ``True`` on your test class.
+
.. _deprecated-features-1.9:
Features deprecated in 1.9
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index 3e5cd63a12..aa66afb1d9 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -606,6 +606,17 @@ features like:
then you should use :class:`~django.test.TransactionTestCase` or
:class:`~django.test.TestCase` instead.
+.. attribute:: SimpleTestCase.allow_database_queries
+
+ .. versionadded:: 1.9
+
+ :class:`~SimpleTestCase` disallows database queries by default. This
+ helps to avoid executing write queries which will affect other tests
+ since each ``SimpleTestCase`` test isn't run in a transaction. If you
+ aren't concerned about this problem, you can disable this behavior by
+ setting the ``allow_database_queries`` class attribute to ``True`` on
+ your test class.
+
``SimpleTestCase`` inherits from ``unittest.TestCase``.
.. warning::