summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2012-11-02 16:33:07 -0400
committerTim Graham <timograham@gmail.com>2012-11-02 18:20:32 -0400
commit90af863410cae9d043f5378a7cfdab92a696b562 (patch)
tree8dd5fb01360de9e7edc7932a31b8a58be93d7d1c
parenta738d80dd1d81addc2cebda5636bb254002acac7 (diff)
[1.5.X] Fixed #19167 - Added a warning regarding module-level database queries
Thanks Daniele Procida for the patch. Backport of 07361d1fd6 from master
-rw-r--r--docs/topics/testing.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
index f5fd4fe3e6..cbef07bced 100644
--- a/docs/topics/testing.txt
+++ b/docs/topics/testing.txt
@@ -379,6 +379,15 @@ control the particular collation used by the test database. See the
:doc:`settings documentation </ref/settings>` for details of these
advanced settings.
+.. admonition:: Finding data from your production database when running tests?
+
+ If your code attempts to access the database when its modules are compiled,
+ this will occur *before* the test database is set up, with potentially
+ unexpected results. For example, if you have a database query in
+ module-level code and a real database exists, production data could pollute
+ your tests. *It is a bad idea to have such import-time database queries in
+ your code* anyway - rewrite your code so that it doesn't do this.
+
.. _topics-testing-masterslave:
Testing master/slave configurations