Unittesting SocketServer.StreamRequestHandler subclasses

Neilen Marais nmarais at ska.ac.za
Fri Sep 9 09:00:21 CEST 2011


Hi,

Is there a recommended way for writing unittests of
SocketServer.StreamRequestHandler subclasses? I've tried making a
server stub class and a connection stub class with a recv() method
that immediately raises socket.error(errno.ECONNRESET, ).

This works OK, but it means that whatever unittests I run always
happens after the handler's handle() method has already been called.
Is there a way to avoid this?

Thanks
Neilen



More information about the Python-list mailing list