[Twisted-Python] Re: [Twisted-commits] CVS: Twisted/twisted/test test_protocols.py,1.6,1.7

Chris Armstrong carmstro at twistedmatrix.com
Tue Sep 25 14:07:49 MDT 2001


I don't understand. why would you want the *tests* to be optimized? I'm
of course definitely against inappropriate asserts in real code (there are
quite a few in twisted I think), but I think asserts are appropriate for
tests (even if it's just the wording that sounds right).

On Tue, Sep 25, 2001 at 08:09:37PM +0200, Moshe Zadka wrote:
> On Tue, 25 Sep 2001, Itamar Shtull-Trauring <itamarst at twistedmatrix.com> wrote:
> 
> > +            assert r.brokenPeer, "connection wasn't closed on illegal netstring %s" % repr(s)
> 
> Itamar, and everybody: STOP DOING THAT!!!!!!!!!!!!!!!!!!!!!!!!
> Don't use "assert" in tests, since they don't operate under python -O.
> Someday, we'll want to test it working ok with -O. (say, if there is some
> less-then-trivial code undef "if __debug__".)
> -- 
> The Official Moshe Zadka FAQ: http://moshez.geek
> The Official Moshe Zadka FAQ For Dummies: http://moshez.org
> Read the FAQ
> 
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list