[Zope-dev] Avoid deprecation warnings in the testrunner
Marius Gedminas
marius at gedmin.as
Mon Dec 28 07:31:23 EST 2009
On Fri, Dec 25, 2009 at 07:49:38AM +0100, Fabio Tranchitella wrote:
> * 2009-12-25 07:32, Lennart Regebro wrote:
> > On Thu, Dec 24, 2009 at 14:50, Fabio Tranchitella <kobold at 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.
I think you mean "assumes doctest is imported in zope.testing's
__init__.py".
There's no difference between modules or packages for the import
statement, witness
mg at platonas:~ $ cd tmp
mg at platonas:~/tmp $ mkdir a
mg at platonas:~/tmp $ touch a/__init__.py
mg at platonas:~/tmp $ mkdir a/b
mg at platonas:~/tmp $ touch a/b/__init__.py
mg at platonas:~/tmp $ touch a/c.py
mg at platonas:~/tmp $ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import a
>>> a.b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'b'
>>> a.c
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'c'
>>>
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/20091228/942272f3/attachment.bin
More information about the Zope-Dev
mailing list