[Zope-dev] Avoid deprecation warnings in the testrunner
Fabio Tranchitella
kobold at kobold.it
Wed Dec 23 07:36:33 EST 2009
Hello,
I think we should provide a zope.testing package which does not emit
deprecation warnings while running the testrunner on other packages,
otherwise there is no way to really understand why the package you are
working on is using a deprecated API.
I propose the patch attached to this message to zope.testing.
It tries to avoid importing zope.testing.doctest unless it is really
needed. In this way, developers can see the DeprecationWarning with the
path of *their* code, and fix it, instead of receiving the
DeprecationWarning because the testrunner imports zope.testing.doctest
itself.
Before applying the patch, running the tests on another package produced
this output:
-----------------------------------------------------------------------
.../zope/testing/testrunner/debug.py:23: DeprecationWarning: zope.testing.doctest is deprecated in favour of the Python standard library doctest module
from zope.testing import doctest
Running zope.testing.testrunner.layer.UnitTests tests:
...
-----------------------------------------------------------------------
After applying my patch, I get this:
-----------------------------------------------------------------------
.../zope/interface/tests/test_adapter.py:405: DeprecationWarning: zope.testing.doctest is deprecated in favour of the Python standard library doctest module
from zope.testing import doctest
Running zope.testing.testrunner.layer.UnitTests tests:
...
-----------------------------------------------------------------------
Comments?
Thanks,
Fabio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zope.testing-no-deprecation.diff
Type: text/x-diff
Size: 3526 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20091223/1483004a/attachment.bin
More information about the Zope-Dev
mailing list