diff options
author | Collin Winter <collinw@gmail.com> | 2007-04-25 17:29:52 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-04-25 17:29:52 (GMT) |
commit | c2898c5a678e6dd00c3e0b18a214fcd7a3533800 (patch) | |
tree | dfaedbddee7b0ef79a19527788b8a720658e79bb /Doc/lib/libtest.tex | |
parent | 0d4c06e06e5ee1f3bb1fa8068114bd700d74864a (diff) | |
download | cpython-c2898c5a678e6dd00c3e0b18a214fcd7a3533800.zip cpython-c2898c5a678e6dd00c3e0b18a214fcd7a3533800.tar.gz cpython-c2898c5a678e6dd00c3e0b18a214fcd7a3533800.tar.bz2 |
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
Diffstat (limited to 'Doc/lib/libtest.tex')
-rw-r--r-- | Doc/lib/libtest.tex | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Doc/lib/libtest.tex b/Doc/lib/libtest.tex index d22f50d..d258089 100644 --- a/Doc/lib/libtest.tex +++ b/Doc/lib/libtest.tex @@ -196,7 +196,9 @@ regression tests. This module defines the following exceptions: \begin{excdesc}{TestFailed} -Exception to be raised when a test fails. +Exception to be raised when a test fails. This is deprecated in favor +of \module{unittest}-based tests and \class{unittest.TestCase}'s +assertion methods. \end{excdesc} \begin{excdesc}{TestSkipped} @@ -273,14 +275,18 @@ filter settings. Execute \class{unittest.TestCase} subclasses passed to the function. The function scans the classes for methods starting with the prefix \samp{test_} and executes the tests individually. -This is the preferred way to execute tests. -\end{funcdesc} -\begin{funcdesc}{run_suite}{suite\optional{, testclass}} -Execute the \class{unittest.TestSuite} instance \var{suite}. -The optional argument \var{testclass} accepts one of the test classes in the -suite so as to print out more detailed information on where the testing suite -originated from. +It is also legal to pass strings as parameters; these should be keys in +\code{sys.modules}. Each associated module will be scanned by +\code{unittest.TestLoader.loadTestsFromModule()}. This is usually seen in +the following \function{test_main()} function: + +\begin{verbatim} +def test_main(): + test_support.run_unittest(__name__) +\end{verbatim} + +This will run all tests defined in the named module. \end{funcdesc} The \module{test.test_support} module defines the following classes: |