summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-12-07 10:48:03 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-12-07 10:48:03 (GMT)
commita4ce2f511689ecd74c2766584fc9cfd292c35ebf (patch)
tree159ffca445a2e8fda8acb5856b84256b817f410b /Doc
parentad809556baf82755b2cfb0fcae637257f31ca2b4 (diff)
downloadcpython-a4ce2f511689ecd74c2766584fc9cfd292c35ebf.zip
cpython-a4ce2f511689ecd74c2766584fc9cfd292c35ebf.tar.gz
cpython-a4ce2f511689ecd74c2766584fc9cfd292c35ebf.tar.bz2
SF bug #855317: unittest: 5.3.9 Getting Extended Error Information
The example code did not work and could not easily be made to work. Since the docs were already complex and the feature was not used (it took two years for the errors to surface), we decided to dedocument it entirely, leaving unittest cleaner than before.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libunittest.tex42
1 files changed, 0 insertions, 42 deletions
diff --git a/Doc/lib/libunittest.tex b/Doc/lib/libunittest.tex
index 05617c2..9ab0111 100644
--- a/Doc/lib/libunittest.tex
+++ b/Doc/lib/libunittest.tex
@@ -900,45 +900,3 @@ either by subclassing or assignment on an instance:
No methods on the resulting object are needed. The default value is
the \class{TestSuite} class.
\end{memberdesc}
-
-
-\subsection{Getting Extended Error Information
- \label{unittest-error-info}}
-
-Some applications can make use of more error information (for example,
-an integrated development environment, or IDE). Such an application
-can retrieve supplemental information about errors and failures by
-using an alternate \class{TestResult} implementation, and extending
-the \method{defaultTestResult()} method of the \class{TestCase} class
-to provide it.
-
-Here is a brief example of a \class{TestResult} subclass which stores
-the actual exception and traceback objects. (Be aware that storing
-traceback objects can cause a great deal of memory not to be reclaimed
-when it otherwise would be, which can have effects that affect the
-behavior of the tests.)
-
-\begin{verbatim}
-import unittest
-
-class MyTestCase(unittest.TestCase):
- def defaultTestResult(self):
- return MyTestResult()
-
-class MyTestResult(unittest.TestResult):
- def __init__(self):
- self.errors_tb = []
- self.failures_tb = []
-
- def addError(self, test, err):
- self.errors_tb.append((test, err))
- unittest.TestResult.addError(self, test, err)
-
- def addFailure(self, test, err):
- self.failures_tb.append((test, err))
- unittest.TestResult.addFailure(self, test, err)
-\end{verbatim}
-
-Tests written using \class{MyTestCase} as the base class, instead of
-\class{TestCase}, will allow tools to extract additional information
-from the results object.