Re: Avoid deprecation warnings in the testrunner

Fabio Tranchitella <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
* 2009-12-25 07:32, Lennart Regebro wrote:
> On Thu, Dec 24, 2009 at 14:50, Fabio Tranchitella <[email protected]> wrote:
> > I don't think we can avoid the error, and to be honest I consider the code
> > in zope.minmax to be wrong.
> >
> > """
> > import zope.testing
> > x = zope.testing.doctest.DocTestFile(...
> > """
> >
> > The import is wrong
> 
> No, that's perferctly correct code and not wrong in any way.

It is not wrong from a syntax point of view, but it is wrong because it
assumes doctest is a sub-module and not a sub-package. As said here:

    http://docs.python.org/tutorial/modules.html#packages

It would have been perfect to write:

import zope.testing.doctest

... avoiding the "embedded" design decision that doctest is a sub-module.

Anyway, I'm happy with whatever fix we apply, as long as we find a way to
not rise the deprecation warning just after an import of zope.testing or a
run of the testrunner.

> What if we hide the warning during the __init__.py import. Will it
> show up the next time, then?

No, because modules/packages are imported only once.

> Maybe we can add deprecations only for the major names in doctest.py?
> That would still raise an error everytime you use it, but only when you
> import a name, not the module.

I thought we deprecated the whole zope.testing.doctest.

Best regards, and Merry Christmas.

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