[Twisted-Python] Help with trial test failure
beenje at gmail.com
Tue Aug 6 14:33:44 MDT 2013
Le 6 août 2013 à 08:28, Glyph <glyph at twistedmatrix.com> a écrit :
> On Aug 5, 2013, at 2:09 AM, Benjamin BERTRAND <beenje at gmail.com> wrote:
>> That's why the inlineCallbacks solves the problem. When I yield on the self.server.dataReceived, I wait for the deferred in the publish methods to fire and everything is clean when I close the connection.
>> Is there another way to do that?
> Jonathan Lange wrote about this a long time ago:
Thanks for the link.
I added a deferred in my RedisPublishService class and fire it at the end of my publish method so that I can wait for it before to close the connection.
> but better than doing that would be to avoid setting up and tearing down real TCP connections during your tests. Those are slower than an in-memory thing (like you would get from twisted.test.proto_helpers, the one and only public module in our 'test' package) and also, as you have discovered, more unpredictable.
> Is there any way to hand txredis a synthetic transport for testing? If not, file a bug on it :).
I guess it's possible to use a synthetic transport, but that wouldn't help much without a "fake" redis server.
That would indeed be nice to have for testing.
I actually just found a dummy txredis client that implements everything internally for testing: https://github.com/williamsjj/dummy-txredis
Might be worth looking at.
But I wonder if implementing a basic redis server with twisted (for testing purpose) wouldn't be nicer?
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python