From b624d75b18b6644adb1e783e1032cbf74da409e7 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Wed, 1 Jul 2015 16:11:59 +1200 Subject: Update documentation --- apidocs/testtools.runtest.RunTest.html | 373 +++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 apidocs/testtools.runtest.RunTest.html (limited to 'apidocs/testtools.runtest.RunTest.html') diff --git a/apidocs/testtools.runtest.RunTest.html b/apidocs/testtools.runtest.RunTest.html new file mode 100644 index 0000000..1f57d3d --- /dev/null +++ b/apidocs/testtools.runtest.RunTest.html @@ -0,0 +1,373 @@ + + + + + testtools.runtest.RunTest : API documentation + + + + + + + + + +
+ + + + + +
+

An object to run a test.

+

RunTest objects are used to implement the internal logic involved in +running a test. TestCase.__init__ stores _RunTest as the class of RunTest +to execute. Passing the runTest= parameter to TestCase.__init__ allows a +different RunTest class to be used to execute the test.

+

Subclassing or replacing RunTest can be useful to add functionality to the +way that tests are run in a given project.

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Instance VariablecaseThe test case that is to be run.
Instance VariableresultThe result object a case is reporting to.
Instance VariablehandlersA list of (ExceptionClass, handler_function) for +exceptions that should be caught if raised from the user +code. Exceptions that are caught are checked against this list in +first to last order. There is a catch-all of 'Exception' at the end +of the list, so to add a new exception to the list, insert it at the +front (which ensures that it will be checked before any existing base +classes in the list. If you add multiple exceptions some of which are +subclasses of each other, add the most specific exceptions last (so +they come before their parent classes in the list).
Instance Variableexception_caughtAn object returned when _run_user catches an +exception.
Method__init__Create a RunTest to run a case.
MethodrunRun self.case reporting activity to result.
Instance Variable_exceptionsA list of caught exceptions, used to do the single +reporting of error/failure/skip etc.
Method_run_oneRun one test reporting to result.
Method_run_prepared_resultRun one test reporting to result.
Method_run_coreRun the user supplied test code.
Method_run_cleanupsRun the cleanups that have been added with addCleanup.
Method_run_userRun a user supplied function.
Method_got_user_exceptionCalled when user code raises an exception.
+ + + +
+ +
+ +
+ + + + + + +
+ case = +
+
+ The test case that is to be run. +
+
+ + + + + + +
+ result = +
+
+ The result object a case is reporting to. +
+
+ + + + + + +
+ handlers = +
+
+ A list of (ExceptionClass, handler_function) for +exceptions that should be caught if raised from the user +code. Exceptions that are caught are checked against this list in +first to last order. There is a catch-all of 'Exception' at the end +of the list, so to add a new exception to the list, insert it at the +front (which ensures that it will be checked before any existing base +classes in the list. If you add multiple exceptions some of which are +subclasses of each other, add the most specific exceptions last (so +they come before their parent classes in the list). +
+
+ + + + + + +
+ exception_caught = +
+
+ An object returned when _run_user catches an +exception. +
+
+ + + + + + +
+ _exceptions = +
+
+ A list of caught exceptions, used to do the single +reporting of error/failure/skip etc. +
+
+ + + + + + +
+ + def + __init__(self, case, handlers=None, last_resort=None): + +
+
+ +
Create a RunTest to run a case.
ParameterscaseA testtools.TestCase test case object.
handlersException handlers for this RunTest. These are stored +in self.handlers and can be modified later if needed.
last_resortA handler of last resort: any exception which is +not handled by handlers will cause the last resort handler to be +called as last_resort(exc_info), and then the exception will be +raised - aborting the test run as this is inside the runner +machinery rather than the confined context of the test.
+
+
+ + + + + + +
+ + def + run(self, result=None): + +
+
+ +
Run self.case reporting activity to result.
ParametersresultOptional testtools.TestResult to report activity to.
ReturnsThe result object the test was run against.
+
+
+ + + + + + +
+ + def + _run_one(self, result): + +
+
+ +
Run one test reporting to result.
ParametersresultA testtools.TestResult to report activity to. +This result object is decorated with an ExtendedToOriginalDecorator +to ensure that the latest TestResult API can be used with +confidence by client code.
ReturnsThe result object the test was run against.
+
+
+ + + + + + +
+ + def + _run_prepared_result(self, result): + +
+
+ +
Run one test reporting to result.
ParametersresultA testtools.TestResult to report activity to.
ReturnsThe result object the test was run against.
+
+
+ + + + + + +
+ + def + _run_core(self): + +
+
+ +
Run the user supplied test code.
+
+
+ + + + + + +
+ + def + _run_cleanups(self, result): + +
+
+ +

Run the cleanups that have been added with addCleanup.

+

See the docstring for addCleanup for more information.

ReturnsNone if all cleanups ran without error, +exception_caught if there was an error.
+
+
+ + + + + + +
+ + def + _run_user(self, fn, *args, **kwargs): + +
+
+ +

Run a user supplied function.

+

Exceptions are processed by _got_user_exception.

ReturnsEither whatever 'fn' returns or exception_caught if +'fn' raised an exception.
+
+
+ + + + + + +
+ + def + _got_user_exception(self, exc_info, tb_label='traceback'): + +
+
+ +

Called when user code raises an exception.

+

If 'exc_info' is a MultipleExceptions, then we recurse into it +unpacking the errors that it's made up from.

Parametersexc_infoA sys.exc_info() tuple for the user error.
tb_labelAn optional string label for the error. If +not specified, will default to 'traceback'.
Returns'exception_caught' if we catch one of the exceptions that +have handlers in 'handlers', otherwise raise the error.
+
+
+ +
+
+ API Documentation for testtools, generated by pydoctor at 2015-07-01 16:11:28. +
+ +
+ + \ No newline at end of file -- cgit v1.2.1