/usr/lib/python2.6/site-packages/nose/plugins
NameSizeModeActions
attrib.py78100644editdlrm
attrib.pyc74280644editdlrm
attrib.pyo74280644editdlrm
base.py313840644editdlrm
base.pyc368100644editdlrm
base.pyo368100644editdlrm
builtin.py7920644editdlrm
builtin.pyc13690644editdlrm
builtin.pyo13690644editdlrm
capture.py27800644editdlrm
capture.pyc45650644editdlrm
capture.pyo45650644editdlrm
cover.py64160644editdlrm
cover.pyc62130644editdlrm
cover.pyo62130644editdlrm
debug.py16790644editdlrm
debug.pyc24810644editdlrm
debug.pyo24810644editdlrm
deprecated.py16390644editdlrm
deprecated.pyc23850644editdlrm
deprecated.pyo23850644editdlrm
doctests.py91470644editdlrm
doctests.pyc98910644editdlrm
doctests.pyo98910644editdlrm
errorclass.py64380644editdlrm
errorclass.pyc80370644editdlrm
errorclass.pyo80370644editdlrm
failuredetail.py15640644editdlrm
failuredetail.pyc23340644editdlrm
failuredetail.pyo23340644editdlrm
isolate.py36740644editdlrm
isolate.pyc47290644editdlrm
isolate.pyo47290644editdlrm
manager.py143300644editdlrm
manager.pyc183700644editdlrm
manager.pyo183700644editdlrm
plugintest.py79940644editdlrm
plugintest.pyc96440644editdlrm
plugintest.pyo96440644editdlrm
prof.py47440644editdlrm
prof.pyc49330644editdlrm
prof.pyo49330644editdlrm
skip.py15720644editdlrm
skip.pyc22890644editdlrm
skip.pyo22890644editdlrm
testid.py48710644editdlrm
testid.pyc54790644editdlrm
testid.pyo54790644editdlrm
__init__.py81690644editdlrm
__init__.pyc84120644editdlrm
__init__.pyo84120644editdlrm
Edit: /usr/lib/python2.6/site-packages/nose/plugins/errorclass.pyo (8037B)
Ñò ßÒÕGc@sÎdZddklZddklZddklZddklZde fd„ƒYZ de fd „ƒYZ d efd „ƒYZ d „Zd „Zd„ZedjoddkZeiƒndS(s. ErrorClass Plugins ------------------ ErrorClass plugins provide an easy way to add support for custom handling of particular classes of exceptions. An ErrorClass plugin defines one or more ErrorClasses and how each is handled and reported on. Each error class is stored in a different attribute on the result, and reported separately. Each error class must indicate the exceptions that fall under that class, the label to use for reporting, and whether exceptions of the class should be considered as failures for the whole test run. ErrorClasses use a declarative syntax. Assign an ErrorClass to the attribute you wish to add to the result object, defining the exceptions, label and isfailure attributes. For example, to declare an ErrorClassPlugin that defines TodoErrors (and subclasses of TodoError) as an error class with the label 'TODO' that is considered a failure, do this: >>> class Todo(Exception): ... pass >>> class TodoError(ErrorClassPlugin): ... todo = ErrorClass(Todo, label='TODO', isfailure=True) The MetaErrorClass metaclass translates the ErrorClass declarations into the tuples used by the error handling and reporting functions in the result. This is an internal format and subject to change; you should always use the declarative syntax for attaching ErrorClasses to an ErrorClass plugin. >>> TodoError.errorClasses # doctest: +ELLIPSIS ((, ('todo', 'TODO', True)),) Let's see the plugin in action. First some boilerplate. >>> import sys >>> import unittest >>> buf = unittest._WritelnDecorator(sys.stdout) Now define a test case that raises a Todo. >>> class TestTodo(unittest.TestCase): ... def runTest(self): ... raise Todo("I need to test something") >>> case = TestTodo() Prepare the result using our plugin. Normally this happens during the course of test execution within nose -- you won't be doing this yourself. For the purposes of this testing document, I'm stepping through the internal process of nose so you can see what happens at each step. >>> plugin = TodoError() >>> result = unittest._TextTestResult(stream=buf, ... descriptions=0, verbosity=2) >>> plugin.prepareTestResult(result) Now run the test. TODO is printed. >>> case(result) # doctest: +ELLIPSIS runTest (....TestTodo) ... TODO: I need to test something Errors and failures are empty, but todo has our test: >>> result.errors [] >>> result.failures [] >>> result.todo # doctest: +ELLIPSIS [(<....TestTodo testMethod=runTest>, '...Todo: I need to test something\n')] >>> result.printErrors() # doctest: +ELLIPSIS ====================================================================== TODO: runTest (....TestTodo) ---------------------------------------------------------------------- Traceback (most recent call last): ... Todo: I need to test something Since we defined a Todo as a failure, the run was not successful. >>> result.wasSuccessful() False iÿÿÿÿ(tinstancemethod(tPlugin(tTextTestResult(tisclasstMetaErrorClasscBseZdZd„ZRS(shMetaclass for ErrorClassPlugins that allows error classes to be set up in a declarative manner. cCs¦g}xn|iƒD]`\}}t|tƒoD|i|ƒx4|D](}|i|||i|iffƒqCWqqWtt|ƒi |||ƒt |ƒ|_ dS(N( titemst isinstancet ErrorClasstpoptappendtlabelt isfailuretsuperRt__init__ttuplet errorClasses(tselftnametbasestattrRtdetailtcls((s;/usr/lib/python2.6/site-packages/nose/plugins/errorclass.pyR bs  ((t__name__t __module__t__doc__R (((s;/usr/lib/python2.6/site-packages/nose/plugins/errorclass.pyR^sRcBseZd„Zd„ZRS(c Osa||_y.x'dD]}t|||i|ƒƒqWWn#tj otd|ƒ‚nXdS(NR R s.%r is a required named argument for ErrorClass(slabels isfailure(RtsetattrRtKeyErrort TypeError(RRtkwtkey((s;/usr/lib/python2.6/site-packages/nose/plugins/errorclass.pyR os !cCs t|iƒS(N(titerR(R((s;/usr/lib/python2.6/site-packages/nose/plugins/errorclass.pyt__iter__xs(RRR R(((s;/usr/lib/python2.6/site-packages/nose/plugins/errorclass.pyRns tErrorClassPlugincBs5eZeZdZdZd„Zd„Zd„ZRS(iècsk|\‰}}tˆƒpdSg}|iD]}||dq/~}t‡fd†|ƒotSdS(Nics tˆ|ƒS((t issubclass(tc(terr_cls(s;/usr/lib/python2.6/site-packages/nose/plugins/errorclass.pyt†s(RRtfiltertTrue(Rttestterrtatbt_[1]tetclasses((R#s;/usr/lib/python2.6/site-packages/nose/plugins/errorclass.pytaddErrors  (cCs”t|dƒp|i|ƒnxl|iD]a\}\}}}||ijo<t||gƒ}t|||ƒ|||f|i|Ws!