[Twisted-Python] Testing AMP-based code

Free Ekanayaka free at 64studio.com
Wed Jun 5 13:13:02 MDT 2013


Hi,

following up from ticket #6502, I'm looking for recommendations/best
practices for writing unit-tests for AMP-based code.

As described in the ticket, the issue I'm currently facing is that the
AMP implementation is subtly not re-entrant safe and doesn't work with a
synchronous transport, for example this code raises an exception:

http://twistedmatrix.com/trac/attachment/ticket/6502/example.py

I'm starting to think that the most appropriate testing strategy would
be to mock/stub AMP.callRemote (or the protocol class altogether)
instead of trying to use a fake transport.

Thoughts?

Cheers,

Free



More information about the Twisted-Python mailing list