twisted.test.test_defer.DeferredTests(unittest.SynchronousTestCase, ImmediateFailureMixin)
class documentationtwisted.test.test_defer
(View In Hierarchy)
Method | setUp | Undocumented |
Method | testCallbackWithoutArgs | Undocumented |
Method | testCallbackWithArgs | Undocumented |
Method | testCallbackWithKwArgs | Undocumented |
Method | testTwoCallbacks | Undocumented |
Method | testDeferredList | Undocumented |
Method | testEmptyDeferredList | Undocumented |
Method | testDeferredListFireOnOneError | Undocumented |
Method | testDeferredListDontConsumeErrors | Undocumented |
Method | testDeferredListConsumeErrors | Undocumented |
Method | testDeferredListFireOnOneErrorWithAlreadyFiredDeferreds | Undocumented |
Method | testDeferredListWithAlreadyFiredDeferreds | Undocumented |
Method | test_cancelDeferredList | When cancelling an unfired defer.DeferredList ,
cancel every defer.Deferred
in the list. |
Method | test_cancelDeferredListCallback | No summary |
Method | test_cancelDeferredListWithFireOnOneCallback | When cancelling an unfired defer.DeferredList
with the flag fireOnOneCallback set, cancel every defer.Deferred
in the list. |
Method | test_cancelDeferredListWithFireOnOneCallbackAndDeferredCallback | No summary |
Method | test_cancelDeferredListWithFireOnOneErrback | When cancelling an unfired defer.DeferredList
with the flag fireOnOneErrback set, cancel every defer.Deferred
in the list. |
Method | test_cancelDeferredListWithFireOnOneErrbackAllDeferredsCallback | No summary |
Method | test_cancelDeferredListWithOriginalDeferreds | Cancelling a defer.DeferredList
will cancel the original defer.Deferred s
passed in. |
Method | test_cancelDeferredListWithException | Cancelling a defer.DeferredList
will cancel every defer.Deferred
in the list even exceptions raised from the cancel method of
the defer.Deferred s. |
Method | test_cancelFiredOnOneCallbackDeferredList | When a defer.DeferredList
has fired because one defer.Deferred
in the list fired with a non-failure result, the cancellation will do
nothing instead of cancelling the rest of the defer.Deferred s. |
Method | test_cancelFiredOnOneErrbackDeferredList | When a defer.DeferredList
has fired because one defer.Deferred
in the list fired with a failure result, the cancellation will do nothing
instead of cancelling the rest of the defer.Deferred s. |
Method | testImmediateSuccess | Undocumented |
Method | testImmediateFailure | Undocumented |
Method | testPausedFailure | Undocumented |
Method | testCallbackErrors | Undocumented |
Method | testUnpauseBeforeCallback | Undocumented |
Method | testReturnDeferred | Undocumented |
Method | test_chainedPausedDeferredWithResult | When a paused Deferred with a result is returned from a callback on another Deferred, the other Deferred is chained to the first and waits for it to be unpaused. |
Method | test_pausedDeferredChained | A paused Deferred encountered while pushing a result forward through a chain does not prevent earlier Deferreds from continuing to execute their callbacks. |
Method | test_gatherResults | Undocumented |
Method | test_gatherResultsWithConsumeErrors | If a Deferred in
the list passed to gatherResults
fires with a failure and consumerErrors is True ,
the failure is converted to a None
result on that Deferred . |
Method | test_cancelGatherResults | When cancelling the defer.gatherResults
call, all the defer.Deferred s
in the list will be cancelled. |
Method | test_cancelGatherResultsWithAllDeferredsCallback | No summary |
Method | test_maybeDeferredSync | defer.maybeDeferred
should retrieve the result of a synchronous function and pass it to its
resulting defer.Deferred . |
Method | test_maybeDeferredSyncError | defer.maybeDeferred
should catch exception raised by a synchronous function and errback its
resulting defer.Deferred
with it. |
Method | test_maybeDeferredAsync | defer.maybeDeferred
should let defer.Deferred
instance pass by so that original result is the same. |
Method | test_maybeDeferredAsyncError | defer.maybeDeferred
should let defer.Deferred
instance pass by so that failure.Failure
returned by the original instance is the same. |
Method | test_innerCallbacksPreserved | No summary |
Method | test_continueCallbackNotFirst | No summary |
Method | test_callbackOrderPreserved | A callback added to a Deferred after
a previous callback attached another Deferred as a
result is run after the callbacks of the other Deferred are
run. |
Method | test_reentrantRunCallbacks | A callback added to a Deferred by a
callback on that Deferred
should be added to the end of the callback chain. |
Method | test_nonReentrantCallbacks | A callback added to a Deferred by a
callback on that Deferred
should not be executed until the running callback returns. |
Method | test_reentrantRunCallbacksWithFailure | After an exception is raised by a callback which was added to a Deferred by a
callback on that Deferred , the
Deferred
should call the first errback with a Failure
wrapping that exception. |
Method | test_synchronousImplicitChain | No summary |
Method | test_asynchronousImplicitChain | No summary |
Method | test_synchronousImplicitErrorChain | No summary |
Method | test_asynchronousImplicitErrorChain | Let a and b be two Deferred s. |
Method | test_doubleAsynchronousImplicitChaining | Deferred
chaining is transitive. |
Method | test_nestedAsynchronousChainedDeferreds | Deferred s can
have callbacks that themselves return Deferred s.
When these "inner" Deferred s fire
(even asynchronously), the callback chain continues. |
Method | test_nestedAsynchronousChainedDeferredsWithExtraCallbacks | No summary |
Method | test_chainDeferredRecordsExplicitChain | When we chain a Deferred , that
chaining is recorded explicitly. |
Method | test_explicitChainClearedWhenResolved | Any recorded chaining is cleared once the chaining is resolved, since it no longer exists. |
Method | test_chainDeferredRecordsImplicitChain | We can chain Deferred s
implicitly by adding callbacks that return Deferred s.
When this chaining happens, we record it explicitly as soon as we can find
out about it. |
Method | test_circularChainWarning | When a Deferred is returned from a callback directly attached to that same Deferred, a warning is emitted. |
Method | test_circularChainException | If the deprecation warning for circular deferred callbacks is configured to be an error, the exception will become the failure result of the Deferred. |
Method | test_repr | The repr() of a Deferred
contains the class name and a representation of the internal Python ID. |
Method | test_reprWithResult | If a Deferred has
been fired, then its repr() contains its result. |
Method | test_reprWithChaining | If a Deferred
a has been fired, but is waiting on another Deferred
b that appears in its callback chain, then
repr(a) says that it is waiting on b . |
Method | test_boundedStackDepth | The depth of the call stack does not grow as more Deferred
instances are chained together. |
Method | test_resultOfDeferredResultOfDeferredOfFiredDeferredCalled | Given three Deferreds, one chained to the next chained to the next, callbacks on the middle Deferred which are added after the chain is created are called once the last Deferred fires. |
Method | test_errbackWithNoArgsNoDebug | Deferred.errback() creates a failure from the current
Python exception. When Deferred.debug is not set no globals or locals are
captured in that failure. |
Method | test_errbackWithNoArgs | Deferred.errback() creates a failure from the current
Python exception. When Deferred.debug is set globals and locals are
captured in that failure. |
Method | test_errorInCallbackDoesNotCaptureVars | An error raised by a callback creates a Failure. The Failure captures
locals and globals if and only if Deferred.debug is set. |
Method | test_errorInCallbackCapturesVarsWhenDebugging | An error raised by a callback creates a Failure. The Failure captures
locals and globals if and only if Deferred.debug is set. |
Method | test_inlineCallbacksTracebacks | defer.inlineCallbacks
that re-raise tracebacks into their deferred should not lose their
tracebacks. |
Method | _callback | Undocumented |
Method | _callback2 | Undocumented |
Method | _errback | Undocumented |
Inherited from SynchronousTestCase:
Instance Variable | failureException | An exception class, defaulting to FailTest . If the test method
raises this exception, it will be reported as a failure, rather than an
exception. All of the assertion methods raise this if the assertion fails. |
Instance Variable | skip | None
or a string explaining why this test is to be skipped. If defined, the test
will not be run. Instead, it will be reported to the result object as
'skipped' (if the TestResult supports skipping). |
Instance Variable | todo | None ,
a string or a tuple of (errors, reason) where
errors is either an exception class or an iterable of
exception classes, and reason is a string. See Todo or makeTodo for
more information. |
Instance Variable | suppress | None
or a list of tuples of (args, kwargs) to be passed to
warnings.filterwarnings . Use these to suppress warnings raised
in a test. Useful for testing deprecated code. See also util.suppress . |
Method | __init__ | Undocumented |
Method | __eq__ | No summary |
Method | __ne__ | Undocumented |
Method | __hash__ | Undocumented |
Method | shortDescription | Undocumented |
Method | getSkip | No summary |
Method | getTodo | No summary |
Method | runTest | If no methodName argument is passed to the constructor, run
will treat this method as the thing with the actual test inside. |
Method | run | Run the test case, storing the results in result . |
Method | addCleanup | Add the given function to a list of functions to be called after the
test has run, but before tearDown . |
Method | patch | Monkey patch an object for the duration of the test. |
Method | flushLoggedErrors | Remove stored errors received from the log. |
Method | flushWarnings | Remove stored warnings from the list of captured warnings and return them. |
Method | callDeprecated | Call a function that should have been deprecated at a specific version and in favor of a specific alternative, and assert that it was thusly deprecated. |
Method | mktemp | Create a new path name which can be used for a new file or directory. |
Method | _getSuppress | No summary |
Method | _getSkipReason | Return the reason to use for skipping a test method. |
Method | _run | Run a single method, either a test method or fixture. |
Method | _runFixturesAndTest | Run setUp , a test method, test cleanups, and
tearDown . |
Method | _runCleanups | Synchronously run any cleanups which have been added. |
Method | _installObserver | Undocumented |
Method | _removeObserver | Undocumented |
Inherited from _Assertions (via SynchronousTestCase):
Method | fail | Absolutely fail the test. Do not pass go, do not collect $200. |
Method | assertFalse | Fail the test if condition evaluates to True. |
Method | assertTrue | Fail the test if condition evaluates to False. |
Method | assertRaises | Fail the test unless calling the function f with the given
args and kwargs raises exception .
The failure will report the traceback and call stack of the unexpected
exception. |
Method | assertEqual | Fail the test if first and second are not
equal. |
Method | assertIs | Fail the test if first is not second . This is
an obect-identity-equality test, not an object equality (i.e.
__eq__ ) test. |
Method | assertIsNot | Fail the test if first is second . This is an
obect-identity-equality test, not an object equality (i.e.
__eq__ ) test. |
Method | assertNotEqual | Fail the test if first == second . |
Method | assertIn | Fail the test if containee is not found in
container . |
Method | assertNotIn | Fail the test if containee is found in
container . |
Method | assertNotAlmostEqual | Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. |
Method | assertAlmostEqual | Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. |
Method | assertApproximates | Fail if first - second >
tolerance |
Method | assertSubstring | Fail if substring does not exist within
astring . |
Method | assertNotSubstring | Fail if astring contains substring . |
Method | assertWarns | Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine. |
Method | assertIsInstance | Fail if instance is not an instance of the given class or
of one of the given classes. |
Method | assertNotIsInstance | Fail if instance is an instance of the given class or of
one of the given classes. |
Method | successResultOf | Return the current success result of deferred or raise
self.failureException . |
Method | failureResultOf | Return the current failure result of deferred or raise
self.failureException . |
Method | assertNoResult | Assert that deferred does not have a result at this
point. |
Method | assertRegex | Fail the test if a regexp search of text
fails. |
Inherited from ImmediateFailureMixin:
Method | assertImmediateFailure | Assert that the given Deferred current result is a Failure with the given exception. |
When cancelling an unfired defer.DeferredList
,
cancel every defer.Deferred
in the list.
When cancelling an unfired defer.DeferredList
without the fireOnOneCallback
and
fireOnOneErrback
flags set, the defer.DeferredList
will be callback with a list
of (success, result)
tuple
s.
When cancelling an unfired defer.DeferredList
with the flag fireOnOneCallback
set, cancel every defer.Deferred
in the list.
When cancelling an unfired defer.DeferredList
with the flag fireOnOneCallback
set, if one of the defer.Deferred
callbacks in its canceller, the defer.DeferredList
will callback with the result and the index of the defer.Deferred
in a tuple
.
When cancelling an unfired defer.DeferredList
with the flag fireOnOneErrback
set, cancel every defer.Deferred
in the list.
When cancelling an unfired defer.DeferredList
with the flag fireOnOneErrback
set, if all the defer.Deferred
callbacks in its canceller, the defer.DeferredList
will callback with a list
of (success, result)
tuple
s.
Cancelling a defer.DeferredList
will cancel the original defer.Deferred
s
passed in.
Cancelling a defer.DeferredList
will cancel every defer.Deferred
in the list even exceptions raised from the cancel
method of
the defer.Deferred
s.
When a defer.DeferredList
has fired because one defer.Deferred
in the list fired with a non-failure result, the cancellation will do
nothing instead of cancelling the rest of the defer.Deferred
s.
When a defer.DeferredList
has fired because one defer.Deferred
in the list fired with a failure result, the cancellation will do nothing
instead of cancelling the rest of the defer.Deferred
s.
When a paused Deferred with a result is returned from a callback on another Deferred, the other Deferred is chained to the first and waits for it to be unpaused.
A paused Deferred encountered while pushing a result forward through a chain does not prevent earlier Deferreds from continuing to execute their callbacks.
If a Deferred
in
the list passed to gatherResults
fires with a failure and consumerErrors
is True
,
the failure is converted to a None
result on that Deferred
.
When cancelling the defer.gatherResults
call, all the defer.Deferred
s
in the list will be cancelled.
When cancelling the defer.gatherResults
call, if all the defer.Deferred
s
callback in their canceller, the defer.Deferred
returned by defer.gatherResults
will be callbacked with the list
of the results.
defer.maybeDeferred
should retrieve the result of a synchronous function and pass it to its
resulting defer.Deferred
.
defer.maybeDeferred
should catch exception raised by a synchronous function and errback its
resulting defer.Deferred
with it.
defer.maybeDeferred
should let defer.Deferred
instance pass by so that original result is the same.
defer.maybeDeferred
should let defer.Deferred
instance pass by so that failure.Failure
returned by the original instance is the same.
Deferred
chaining is transitive.
In other words, let A, B, and C be Deferreds. If C is returned from a callback on B and B is returned from a callback on A then when C fires, A fires.
When we chain a Deferred
, that
chaining is recorded explicitly.
When a Deferred is returned from a callback directly attached to that same Deferred, a warning is emitted.
If the deprecation warning for circular deferred callbacks is configured to be an error, the exception will become the failure result of the Deferred.
The repr()
of a Deferred
contains the class name and a representation of the internal Python ID.
The depth of the call stack does not grow as more Deferred
instances are chained together.
Given three Deferreds, one chained to the next chained to the next, callbacks on the middle Deferred which are added after the chain is created are called once the last Deferred fires.
This is more of a regression-style test. It doesn't exercise any particular code path through the current implementation of Deferred, but it does exercise a broken codepath through one of the variations of the implementation proposed as a resolution to ticket #411.
Deferred.errback()
creates a failure from the current
Python exception. When Deferred.debug is not set no globals or locals are
captured in that failure.
Deferred.errback()
creates a failure from the current
Python exception. When Deferred.debug is set globals and locals are
captured in that failure.
An error raised by a callback creates a Failure. The Failure captures
locals and globals if and only if Deferred.debug
is set.
An error raised by a callback creates a Failure. The Failure captures
locals and globals if and only if Deferred.debug
is set.
defer.inlineCallbacks
that re-raise tracebacks into their deferred should not lose their
tracebacks.