[Python-checkins] devguide: Discuss the writing of tests.

brett.cannon python-checkins at python.org
Wed Jan 5 23:11:21 CET 2011


brett.cannon pushed 0b915adc0c34 to devguide:

http://hg.python.org/devguide/rev/0b915adc0c34
changeset:   31:0b915adc0c34
tag:         tip
user:        Brett Cannon <brett at python.org>
date:        Wed Jan 05 14:10:29 2011 -0800
summary:
  Discuss the writing of tests.

files:
  runtests.rst

diff --git a/runtests.rst b/runtests.rst
--- a/runtests.rst
+++ b/runtests.rst
@@ -46,4 +46,16 @@
 Writing
 -------
 
-XXX
+Writing tests for Python is much like writing tests for your own code. Tests
+need to be thorough, fast, isolated, consistently repeatable, and as simple as
+possible. Tests live in the ``Lib/test`` directory, where every file that
+includes tests has a ``test_`` prefix.
+
+One difference, though, is that you are allowed to use the ``test.support``
+module. It contains various helpers that are tailored to Python's test suite.
+Because of this it has no API or backwards-compatibility guarantees, which is
+why the general public is not supposed to use the module. But when you are
+writing tests for Python's test suite its use is encouraged.
+
+If your test must write various temporary files to a specific directory, you
+can use the ``Lib/test/data`` directory for that purpose.

--
Repository URL: http://hg.python.org/devguide


More information about the Python-checkins mailing list