Re: Avoid deprecation warnings in the testrunner
Marius Gedminas <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <20091228123123.GB3754@platonas> |
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 <[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. 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@platonas:~ $ cd tmp mg@platonas:~/tmp $ mkdir a mg@platonas:~/tmp $ touch a/__init__.py mg@platonas:~/tmp $ mkdir a/b mg@platonas:~/tmp $ touch a/b/__init__.py mg@platonas:~/tmp $ touch a/c.py mg@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 _______________________________________________ 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 )
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQFLOKUbkVdEXeem148RAkKsAJ9ylInlEknAnG2gqy27H2dLn3gsLgCfftLs rcnTVgmQQmCQynAnZS1GTxw= =oiCA -----END PGP SIGNATURE-----