Re: Python 2.7 disables deprecation warnings by default
Marius Gedminas <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <20100707131639.GA25212@platonas> |
On Wed, Jul 07, 2010 at 02:43:14PM +0200, Hanno Schlichting wrote: > On Wed, Jul 7, 2010 at 12:55 PM, Jim Fulton <[email protected]> wrote: > > I'm not sure what the best way to handle this is. My initial thought > > is that all test runners should enable deprecations by default. This > > seems hard to enforce. > > What about letting the testrunner (zope.testing / zope.testrunner) > enable deprecation warnings by default, but add a command line switch > to disable them or use the Python default? +1 Although tests that check for functions emitting DeprecationWarnings should not rely on this; they should explicitly ensure DeprecationWarnings are not filtered away in their own setup. > > Individual test modules can do this, but I'm uncomfortable having a > > test script make a global setting like this and the warning module > > doesn't seem to provide a way to capture the current state so it can > > be reset after running tests. There's the warnings.catch_warnings context manager (since Python 2.6): http://docs.python.org/library/warnings.html#testing-warnings I'm sure it can be backported to older Python versions, or the test setUp/tearDown can fiddle with warnings.filters[:] directly. 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, 198 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkw0fjcACgkQkVdEXeem14+O8gCfX1XjgXOm/vIn3H2WRLspYiw0 IyYAniLOceZKCxX0WyW315e1E8AeP4hM =MBdE -----END PGP SIGNATURE-----