* 2009-12-25 07:32, Lennart Regebro wrote:
On Thu, Dec 24, 2009 at 14:50, Fabio Tranchitella <kobold@kobold.it> 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