Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`internet`.`testing``

module documentation
(source)

Assorted functionality which is commonly useful when writing unit tests.

Class | `AccumulatingProtocol` | `AccumulatingProtocol` is an `IProtocol` implementation which collects the data delivered to it and can fire a Deferred when it is connected or disconnected.
Class | `EventLoggingObserver` | `ILogObserver` That stores its events in a list for later inspection. This class is similar to `LimitedHistoryLogObserver` save that the internal buffer is public and intended for external inspection. The observer implements the sequence protocol to ease iteration of the events.
Class | `FakeDatagramTransport` | Undocumented
Class | `LineSendingProtocol` | Undocumented
Class | `MemoryReactor` | A fake reactor to be used in tests. This reactor doesn't actually do much that's useful yet. It accepts TCP connection setup attempts, but they will never succeed.
Class | `MemoryReactorClock` | Undocumented
Class | `NonStreamingProducer` | A pull producer which writes 10 times only.
Class | `RaisingMemoryReactor` | A fake reactor to be used in tests. It accepts TCP connection setup attempts, but they will fail.
Class | `StringIOWithoutClosing` | A BytesIO that can't be closed.
Class | `StringTransport` | A transport implementation which buffers data in memory and keeps track of its other state without providing any behavior.
Class | `StringTransportWithDisconnection` | A `StringTransport` which on disconnection will trigger the connection lost on the attached protocol.
Function | `waitUntilAllDisconnected` | Take a list of disconnecting protocols, callback a `Deferred` when they're all done.
Class | `_FakeConnector` | A fake `IConnector` that allows us to inspect if it has been told to stop connecting.
Class | `_FakePort` | A fake `IListeningPort` to be used in tests.
Constant | `_P` | Undocumented

def waitUntilAllDisconnected(reactor, protocols): (source)

Take a list of disconnecting protocols, callback a `Deferred` when they're all done.

This is a hack to make some older tests less flaky, as `ITransport.loseConnection` is not atomic on all reactors (for example, the CoreFoundation, which sometimes takes a reactor turn for CFSocket to realise). New tests should either not use real sockets in testing, or take the advice in https://jml.io/pages/how-to-disconnect-in-twisted-really.html to heart.

Parameters
reactor:`IReactorTime` | The reactor to schedule the checks on.
protocols:A `list` of `IProtocol`s. | The protocols to wait for disconnecting.

_P = (source)

Undocumented

Value

    ParamSpec('_P')