I think the "recommended" way to get access to a reactor instance is to
pass it in to methods that require it.

While this can sometimes seem tedious it a) helps testing (because now
you can easily pass a fake reactor object like Clock or a Mock instance)
and b) shows you (and your users) which methods are (or might-be) async.

So, try a signature like "def terrific_method(reactor):" instead. Now
when you're writing tests, you can do this:

    fake_reactor = Clock()
    d = terrific_method(fake_reactor)
    fake_reactor.advance(2)
    # etc.

-- 
meejah

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to