[Twisted-Python] Testing AMP-based code

Glyph glyph at twistedmatrix.com
Wed Jun 12 23:00:24 MDT 2013

On Jun 12, 2013, at 4:16 PM, exarkun at twistedmatrix.com wrote:


> So this all means that your application logic can all live on a CommandLocator subclass.  When you really want to put this on an AMP server, you can hook an AMP instance up to your CommandLocator subclass (AMP takes a locator as an __init__ argument).  When you want to test your command implementations, you can hook the CommandLocator up to a BoxDispatcher and a box sender and throw boxes straight at it with no network interation.

Thanks a lot for this description.  Someone (maybe you if you're feeling generous, or someone else if they'd like to volunteer) should take most of the prose from this post, edit it a little bit to fit into the flow, and use it to expand the somewhat bare explanation of these concepts in <http://twistedmatrix.com/documents/current/core/howto/amp.html>.

> Some pieces are probably still missing from the public API - for example, you do want to test that your objects all get properly serialized and deserialized through AMP, particularly if you're implementing custom Argument types.  There are some private APIs, _objectsToStrings and _stringsToObjects mostly, that really help with testing this, and we should think about how to expose this functionality publically.  Also, we should document this whole pile of stuff.  Maybe you'd be interested in writing something up after you've had a chance to play with these ideas?

It would also be nice if someone could find a link to the tickets for this functionality - or, file one, if none exist.

Again, thanks a lot for the great explanation, JP.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130612/0cc20665/attachment.html>

More information about the Twisted-Python mailing list