albert.brandl at weiermayer.com
Mon Mar 29 07:11:00 EDT 2010
On Fri, Mar 26, 2010 at 12:08:02PM -0000, exarkun at twistedmatrix.com wrote:
> So, are you sure this is testing what you think it's testing?
Yes. This test was already there, and it failed in unexpected ways, so I
had to look at it quite closely. I'm not too happy about it, since it
tests several things at once (illegal strings, bytewise delivery), but I
decided to leave it there for now, just to make sure that I don't miss
some test case with the new unit tests.
As Andrew pointed out, this unittest assumes that dataReceived is still
(somewhat) functional after the detection of an invalid netstring. This
does not make much sense IMO, and it complicates the code. I'd prefer
to raise an exception and adapt the unittest accordingly.
But I still don't know which exception would be best. There is a
ConnectionLost exception, which is raised in
twisted.protocols.amp.BinaryBoxProtocol when the transport is None.
Other options are ConnectionClosed and ConnectionDone (both are not
raised directly anywhere), or a new one. Maybe ConnectionLost is the
most appropriate one.
DI Albert Brandl
Weiermayer Solutions GmbH | http://www.weiermayer.com
4813 Altmünster | Abteistraße 12 | Austria
Fon: +43(0)720 70 30 14 | Fax: +43 (0) 7612 88081
More information about the Twisted-Python