summaryrefslogtreecommitdiff
path: root/Doc/lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-06 13:37:45 +0000
committerGeorg Brandl <georg@python.org>2007-03-06 13:37:45 +0000
commitff432e6f4ad8e4430ce984ec883a3d038e1c7ab9 (patch)
tree9e80574fb8d33086e2305fc5aba42d456f2068ca /Doc/lib
parent72363031b9d2b382d6d8c8703f716da982dcbbdf (diff)
downloadcpython-git-ff432e6f4ad8e4430ce984ec883a3d038e1c7ab9.tar.gz
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libdoctest.tex25
1 files changed, 25 insertions, 0 deletions
diff --git a/Doc/lib/libdoctest.tex b/Doc/lib/libdoctest.tex
index 957ecf48cc..40602360c9 100644
--- a/Doc/lib/libdoctest.tex
+++ b/Doc/lib/libdoctest.tex
@@ -201,6 +201,19 @@ prohibit it by passing \code{verbose=False}. In either of those cases,
\code{sys.argv} is not examined by \function{testmod()} (so passing
\programopt{-v} or not has no effect).
+Since Python 2.6, there is also a command line shortcut for running
+\function{testmod()}. You can instruct the Python interpreter to run
+the doctest module directly from the standard library and pass the module
+name(s) on the command line:
+
+\begin{verbatim}
+python -m doctest -v example.py
+\end{verbatim}
+
+This will import \file{example.py} as a standalone module and run
+\function{testmod()} on it. Note that this may not work correctly if the
+file is part of a package and imports other submodules from that package.
+
For more information on \function{testmod()}, see
section~\ref{doctest-basic-api}.
@@ -267,6 +280,18 @@ Like \function{testmod()}, \function{testfile()}'s verbosity can be
set with the \programopt{-v} command-line switch or with the optional
keyword argument \var{verbose}.
+Since Python 2.6, there is also a command line shortcut for running
+\function{testfile()}. You can instruct the Python interpreter to run
+the doctest module directly from the standard library and pass the file
+name(s) on the command line:
+
+\begin{verbatim}
+python -m doctest -v example.txt
+\end{verbatim}
+
+Because the file name does not end with \file{.py}, \module{doctest} infers
+that it must be run with \function{testfile()}, not \function{testmod()}.
+
For more information on \function{testfile()}, see
section~\ref{doctest-basic-api}.