[Zope-dev] Python 2.7 disables deprecation warnings by default

Hanno Schlichting hanno at hannosch.eu
Wed Jul 7 08:43:14 EDT 2010


On Wed, Jul 7, 2010 at 12:55 PM, Jim Fulton <jim at zope.com> 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.
>
> 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.

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?

The test.py script from Zope 2 used to have a --nowarn option to
disable all warnings.

I think developers should always care about deprecation warnings and
it's only developers who will run tests. I can understand why normal
users of a Python program shouldn't see deprecation warnings - they
usually cannot do anything about them. I also heard many reports from
people asking questions about those deprecation warnings in a Plone
context. Normal users don't know the difference between a deprecation
warning and a SyntaxError or any other warning for that matter. All
they see is a "warning" and get anxious.

Hanno


More information about the Zope-Dev mailing list