[Zope-dev] whitespace filtering corner case in doctest

Marius Gedminas marius at gedmin.as
Mon Aug 17 15:08:27 EDT 2009


On Mon, Aug 17, 2009 at 02:46:46PM +0000, Reinout van Rees wrote:
> In some cases, importing readline can result in the escape code ^[[?1034h to
> be send ("8bit on").

According to the gentoo bug report (liked from your blog post), this
happens if your termcap/terminfo define smm/rmm codes ("meta on/meta
off").

BTW, regarding your workaround: I'd suggest using TERM=dummy instead of
TERM=linux, as a safer choice.  Not that it should matter much in
practice.

> This escape code isn't visible, which leads to hard to
> find test errors, see
> http://reinout.vanrees.org/weblog/2009/07/16/invisible-test-diff.html
> 
> Granted, it are basically corner cases.
> 
> On the other hand, it does seem to cause problems now and then, according to
> my googling.  Would it be ok to add it to the whitespace normalization of
> doctests?  Opinions?

Well, it's not whitespace, really...  My gut feeling is that this fixup
doesn't belong in the core doctest code.

If this happened in my project, I'd either

  1) make sure I import readline at module level, before any tests are
     run

or

  2) add a renormalizer that removes the escape sequence for the test
     that triggers this


Perhaps it would be nice if doctest's differ escaped ASCII control
characters?  (You could do that too with a renormalizer.)

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3 consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20090817/dc5a26d7/attachment.bin 


More information about the Zope-Dev mailing list