unittest.TestCase.addTypeEqualityFunc()

addTypeEqualityFunc(typeobj, function) Registers a type-specific method called by assertEqual() to check if two objects of exactly the same typeobj (not subclasses) compare equal. function must take two positional arguments and a third msg=None keyword argument just as assertEqual() does. It must raise self.failureException(msg) when inequality between the first two parameters is detected – possibly providing useful information and explaining the inequalities in details in the error message.

unittest.TestCase.addCleanup()

addCleanup(function, *args, **kwargs) Add a function to be called after tearDown() to cleanup resources used during the test. Functions will be called in reverse order to the order they are added (LIFO). They are called with any arguments and keyword arguments passed into addCleanup() when they are added. If setUp() fails, meaning that tearDown() is not called, then any cleanup functions added will still be called. New in version 3.1.

unittest.TestCase

class unittest.TestCase(methodName='runTest') Instances of the TestCase class represent the logical test units in the unittest universe. This class is intended to be used as a base class, with specific tests being implemented by concrete subclasses. This class implements the interface needed by the test runner to allow it to drive the tests, and methods that the test code can use to check for and report various kinds of failure. Each instance of TestCase will run a single base method: the me

unittest.skipUnless()

@unittest.skipUnless(condition, reason) Skip the decorated test unless condition is true.

unittest.SkipTest

exception unittest.SkipTest(reason) This exception is raised to skip a test. Usually you can use TestCase.skipTest() or one of the skipping decorators instead of raising this directly.

unittest.skipIf()

@unittest.skipIf(condition, reason) Skip the decorated test if condition is true.

unittest.skip()

@unittest.skip(reason) Unconditionally skip the decorated test. reason should describe why the test is being skipped.

unittest.removeResult()

unittest.removeResult(result) Remove a registered result. Once a result has been removed then stop() will no longer be called on that result object in response to a control-c.

unittest.removeHandler()

unittest.removeHandler(function=None) When called without arguments this function removes the control-c handler if it has been installed. This function can also be used as a test decorator to temporarily remove the handler whilst the test is being executed: @unittest.removeHandler def test_signal_handling(self): ...

unittest.registerResult()

unittest.registerResult(result) Register a TestResult object for control-c handling. Registering a result stores a weak reference to it, so it doesn’t prevent the result from being garbage collected. Registering a TestResult object has no side-effects if control-c handling is not enabled, so test frameworks can unconditionally register all results they create independently of whether or not handling is enabled.