Assorted functionality which is commonly useful when writing unit tests.
|Class||StringTransport||A transport implementation which buffers data in memory and keeps track of its other state without providing any behavior.|
|Class||StringIOWithoutClosing||A BytesIO that can't be closed.|
|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||RaisingMemoryReactor||A fake reactor to be used in tests. It accepts TCP connection setup attempts, but they will fail.|
|Class||NonStreamingProducer||A pull producer which writes 10 times only.|
|Function||waitUntilAllDisconnected||Take a list of disconnecting protocols, callback a
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||The reactor to schedule the checks on. (type: |
|protocols||The protocols to wait for disconnecting. (type: A |