[Zope-dev] Avoid deprecation warnings in the testrunner

Fabio Tranchitella kobold at kobold.it
Thu Dec 24 08:50:52 EST 2009


* 2009-12-24 11:40, Lennart Regebro wrote:
> On Thu, Dec 24, 2009 at 08:26, Fabio Tranchitella <kobold at kobold.it> wrote:
> > I've tested the whole ZTK KGS using the current zope.testing's trunk and
> > the only failing package was zope.minmax (already fixed in the trunk),
> > because it imported zope.testing and used zope.testing.doctest, which fails
> > now that doctest is a directory and not a file, as Lennnart pointed out.
> 
> It does? 

Yes, definitely.

> But the code is moved to doctest/__init__.py. That should work...

No, it does not because now doctest is a package.

> Or maybe we need to do an import doctest from zope/testing/__init__.py
> for it to show up, I don't remember.

Yes, you are right, but if I'd do that, the deprecation warning would be
raised by the simple import of zope.testing, making it useless because it
would mask the warnings related to the package you are running the tests
for.

> Can we avoid this error? The whole point with the deprecation is to
> NOT break code. ;)

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, it should be "zope.testing.doctest", and I fixed it in
the trunk, and this was the only failure in the ZTK.

Thanks for your support,
Fabio


More information about the Zope-Dev mailing list