testing.util

Module: testing.util

Inheritance diagram for IPython.testing.util:

This file contains utility classes for performing tests with Deferreds.

DeferredTestCase

class IPython.testing.util.DeferredTestCase(methodName='runTest')

Bases: twisted.trial.unittest.TestCase

__init__(methodName='runTest')

Construct an asynchronous test case for C{methodName}.

@param methodName: The name of a method on C{self}. This method should be a unit test. That is, it should be a short method that calls some of the assert* methods. If C{methodName} is unspecified, L{runTest} will be used as the test method. This is mostly useful for testing Trial.

assertDeferredEquals(deferred, expectedResult, chainDeferred=None)

Calls assertEquals on the result of the deferred and expectedResult.

chainDeferred can be used to pass in previous Deferred objects that have tests being run on them. This chaining of Deferred’s in tests is needed to insure that all Deferred’s are cleaned up at the end of a test.

assertDeferredRaises(deferred, expectedException, chainDeferred=None)

Calls assertRaises on the Failure of the deferred and expectedException.

chainDeferred can be used to pass in previous Deferred objects that have tests being run on them. This chaining of Deferred’s in tests is needed to insure that all Deferred’s are cleaned up at the end of a test.