[Zope-dev] zope.testing.doctestunit and BBB

Marius Gedminas marius at gedmin.as
Tue Dec 22 04:26:16 EST 2009


On Mon, Dec 21, 2009 at 10:27:01PM +0100, Lennart Regebro wrote:
> I added the imports back, and also some deprecation warnings, although
> I'm not sure how to best add them,

Maybe zope.deprecation can help?

> so I just stuck them in the
> modules, so the first import will raise a warning. A new release would
> be great, I guess. Christian, what do you say?

The warning in zope.testing.doctestunit says "zope.testing.doctest is
deprecated", I think it should say "doctestunit".  I fixed that in svn
(and added stacklevel=2, so you can see where in your code those modules
are imported).


Should zope.testing.doctestunit.pprint be deprecated?

It's trying to fix a misfeature of stdlib's pprint.pprint, which is that
pprinting a dict will output its repr() if len(repr(a_dict)) is narrower
than the desired wrapping width.  The order of keys and values of a
dict's repr() is not well-defined, which tends to cause issues for
doctests.  zope.testing.doctestunit.pprint works around it by hardcoding
the wrapping width to 1, which results in somewhat ugly output, but
forces the stdlib's pretty-printer to sort dict keys alphabetically.

I don't have strong feelings one way or another.  I have 18 test files
that use zope.testing.doctestunit.pprint, but since I always found its
output ugly, I wouldn't mind writing some custom dict printing
functions.

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/20091222/a264b07a/attachment.bin 


More information about the Zope-Dev mailing list