[Twisted-Python] Global reactor unit tests in the Twisted test suite

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Nov 1 10:38:38 EDT 2011


I'd like for us to decide that we will introduce no new unit tests into 
Twisted's test suite which use the global reactor.

These tests require extra complexity in trial - to support the Deferred, 
to check for left over event sources (incompletely implemented), and to 
clean up left over event sources (incompletely implemented).

The tests themselves are also complicated by the need to clean up those 
event sources.

The tests only exercise functionality against one reactor at a time 
which leads to additional challenges for buildbot.

If a test is for reactor functionality with multiple implementations, 
the ReactorBuilder-style tests are better.  If a test is for 
implementation details of a particular reactor, I think the necessary 
parts of that reactor should just be invoked directly - on a new 
instance.  For anything that's not a test for reactor functionality, no 
reactor should be involved at all (protocol implementations, etc).

I've mentioned these ideas to various people at various times, but they 
don't seem to be catching on, so I'd like to hear why and come to some 
conclusion about how we're going to write tests in the future.


More information about the Twisted-Python mailing list