| |
- JUnitTextTestRunner
- TestCase
-
- FunctionTestCase
- TestProgram
- TestResult
-
- _JUnitTextTestResult
- _VerboseTextTestResult
- TestSuite
- VerboseTextTestRunner
- _WritelnDecorator
class TestCase |
|
A class whose instances are single test cases.
Test authors should subclass TestCase for their own tests. Construction
and deconstruction of the test's environment ('fixture') can be
implemented by overriding the 'setUp' and 'tearDown' methods respectively.
By default, the test code itself should be placed in a method named
'runTest'.
If the fixture may be used for many test cases, create as
many test methods as are needed. When instantiating such a TestCase
subclass, specify in the constructor arguments the name of the test method
that the instance is to execute.
|
| |
- __exc_info(self)
- Return a version of sys.exc_info() with the traceback frame
- minimised; usually the top level of the traceback frame is not
- needed.
- __call__(self, result=None)
- no doc string
- __init__(self, methodName='runTest')
- Create an instance of the class that will use the named test
- method when executed. Raises a ValueError if the instance does
- not have a method with the specified name.
- __repr__(self)
- no doc string
- __str__(self)
- no doc string
- assertRaises(self, excClass, callableObj, *args, **kwargs)
- Assert that an exception of class excClass is thrown
- by callableObj when invoked with arguments args and keyword
- arguments kwargs. If a different type of exception is
- thrown, it will not be caught, and the test case will be
- deemed to have suffered an error, exactly as for an
- unexpected exception.
- assert_(self, expr, msg=None)
- Equivalent of built-in 'assert', but is not optimised out when
- __debug__ is false.
- countTestCases(self)
- no doc string
- defaultTestResult(self)
- no doc string
- fail(self, msg=None)
- Fail immediately, with the given message.
- failIf(self, expr, msg=None)
- Fail the test if the expression is true.
- assert_(self, expr, msg=None)
- Equivalent of built-in 'assert', but is not optimised out when
- __debug__ is false.
- id(self)
- no doc string
- run(self, result=None)
- no doc string
- setUp(self)
- Hook method for setting up the test fixture before exercising it.
- shortDescription(self)
- Returns a one-line description of the test, or None if no
- description has been provided.
-
- The default implementation of this method returns the first line of
- the specified test method's docstring.
- tearDown(self)
- Hook method for deconstructing the test fixture after testing it.
|
class TestResult |
|
Holder for test result information.
Test results are automatically managed by the TestCase and TestSuite
classes, and do not need to be explicitly manipulated by writers of tests.
Each instance holds the total number of tests run, and collections of
failures and errors that occurred among those test runs. The collections
contain tuples of (testcase, exceptioninfo), where exceptioninfo is a
tuple of values as returned by sys.exc_info().
|
| |
- __init__(self)
- no doc string
- __repr__(self)
- no doc string
- addError(self, test, err)
- Called when an error has occurred
- addFailure(self, test, err)
- Called when a failure has occurred
- startTest(self, test)
- Called when the given test is about to be run
- stop(self)
- Indicates that the tests should be aborted
- stopTest(self, test)
- Called when the given test has been run
- wasSuccessful(self)
- Tells whether or not this result was a success
|
class TestSuite |
|
A test suite is a composite test consisting of a number of TestCases.
For use, create an instance of TestSuite, then add test case instances.
When all tests have been added, the suite can be passed to a test
runner, such as TextTestRunner. It will run the individual test cases
in the order in which they were added, aggregating the results. When
subclassing, do not forget to call the base class constructor.
|
| |
- __call__(self, result)
- no doc string
- __init__(self, tests=())
- no doc string
- __repr__(self)
- no doc string
- __repr__(self)
- no doc string
- addTest(self, test)
- no doc string
- addTests(self, tests)
- no doc string
- countTestCases(self)
- no doc string
- run(self, result)
- no doc string
|
class _VerboseTextTestResult(TestResult) |
|
A test result class that can print formatted text results to a stream.
Used by VerboseTextTestRunner.
|
| |
- __init__(self, stream, descriptions)
- no doc string
- _printError(self, flavour, test, err)
- no doc string
- addError(self, test, err)
- no doc string
- addFailure(self, test, err)
- no doc string
- startTest(self, test)
- no doc string
- stopTest(self, test)
- no doc string
|
|