29 Jul
2016
29 Jul
'16
7:11 p.m.
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