Re: zope.testing.doctestunit and BBB

Lennart Regebro <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On Tue, Dec 22, 2009 at 10:26, Marius Gedminas <[email protected]> wrote:
> 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?

I didn't find anything obvious.

> The warning in zope.testing.doctestunit says "zope.testing.doctest is
> deprecated", I think it should say "doctestunit".

Oups.

>  I fixed that in svn
> (and added stacklevel=2, so you can see where in your code those modules
> are imported).

Ah, right. Forgot that.

> 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.

Aha.

> 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.

I have no opinion either, I don't use it, but it does seem slightly practical.

-- 
Lennart Regebro: http://regebro.wordpress.com/
Python 3 Porting: http://python-incompatibility.googlecode.com/
+33 661 58 14 64
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.