[Checkins] SVN: zope.interface/trunk/ Drop explicit DeprecationWarnings for "class advice" APIS
Tres Seaver
cvs-admin at zope.org
Tue May 22 20:00:50 UTC 2012
Log message for revision 126443:
Drop explicit DeprecationWarnings for "class advice" APIS
These APIs are still deprecated under Python 2.x, and still raise an
exception under Python 3.x, but no longer cause a warning to be emitted
under Python 2.x.
Changed:
_U zope.interface/trunk/
U zope.interface/trunk/CHANGES.txt
U zope.interface/trunk/src/zope/interface/declarations.py
U zope.interface/trunk/src/zope/interface/tests/test_declarations.py
-=-
Modified: zope.interface/trunk/CHANGES.txt
===================================================================
--- zope.interface/trunk/CHANGES.txt 2012-05-22 18:15:17 UTC (rev 126442)
+++ zope.interface/trunk/CHANGES.txt 2012-05-22 20:00:35 UTC (rev 126443)
@@ -4,7 +4,10 @@
4.0.1 (unreleased)
------------------
-- TBA
+- Dropped explicit ``DeprecationWarnings`` for "class advice" APIS (these
+ APIs are still deprecated under Python 2.x, and still raise an exception
+ under Python 3.x, but no longer cause a warning to be emitted under
+ Python 2.x).
4.0.0 (2012-05-16)
------------------
Modified: zope.interface/trunk/src/zope/interface/declarations.py
===================================================================
--- zope.interface/trunk/src/zope/interface/declarations.py 2012-05-22 18:15:17 UTC (rev 126442)
+++ zope.interface/trunk/src/zope/interface/declarations.py 2012-05-22 20:00:35 UTC (rev 126443)
@@ -402,9 +402,6 @@
# the coverage for this block there. :(
if PYTHON3: #pragma NO COVER
raise TypeError(_ADVICE_ERROR % 'implementer')
- else:
- warnings.warn(_ADVICE_WARNING % ('implements', 'implementer'),
- DeprecationWarning, 2)
_implements("implements", interfaces, classImplements)
def implementsOnly(*interfaces):
@@ -433,9 +430,6 @@
# the coverage for this block there. :(
if PYTHON3: #pragma NO COVER
raise TypeError(_ADVICE_ERROR % 'implementer_only')
- else:
- warnings.warn(_ADVICE_WARNING % ('implementsOnly', 'implementer_only'),
- DeprecationWarning, 2)
_implements("implementsOnly", interfaces, classImplementsOnly)
##############################################################################
@@ -642,9 +636,6 @@
if PYTHON3: #pragma NO COVER
raise TypeError(_ADVICE_ERROR % 'provider')
- else:
- warnings.warn(_ADVICE_WARNING % ('classProvides', 'provider'),
- DeprecationWarning, 2)
frame = sys._getframe(1)
locals = frame.f_locals
Modified: zope.interface/trunk/src/zope/interface/tests/test_declarations.py
===================================================================
--- zope.interface/trunk/src/zope/interface/tests/test_declarations.py 2012-05-22 18:15:17 UTC (rev 126442)
+++ zope.interface/trunk/src/zope/interface/tests/test_declarations.py 2012-05-22 20:00:35 UTC (rev 126443)
@@ -34,17 +34,14 @@
def _run_generated_code(self, code, globs, locs,
fails_under_py3k=True,
- warnings_under_py2=1):
+ ):
import warnings
from zope.interface._compat import PYTHON3
with warnings.catch_warnings(record=True) as log:
warnings.resetwarnings()
if not PYTHON3:
exec(code, globs, locs)
- if warnings_under_py2:
- self.assertEqual(len(log), warnings_under_py2)
- for entry in log:
- self.assertEqual(entry.category, DeprecationWarning)
+ self.assertEqual(len(log), 0) # no longer warn
return True
else:
try:
@@ -677,8 +674,7 @@
Foo = locs['Foo']
spec = Foo.__implemented__
self.assertEqual(list(spec), [IFoo])
- self.assertEqual(len(log), 1)
- self.assertEqual(log[0].category, DeprecationWarning)
+ self.assertEqual(len(log), 0) # no longer warn
def test_called_once_from_class_w_bases(self):
from zope.interface.declarations import implements
@@ -698,7 +694,7 @@
'class Bar(Foo):'
' implementsOnly(IBar)',
])
- if self._run_generated_code(CODE, globs, locs, warnings_under_py2=2):
+ if self._run_generated_code(CODE, globs, locs):
Bar = locs['Bar']
spec = Bar.__implemented__
self.assertEqual(list(spec), [IBar])
@@ -721,13 +717,12 @@
'def foo():',
' implements(IFoo)'
])
- if self._run_generated_code(CODE, globs, locs, False, 0):
+ if self._run_generated_code(CODE, globs, locs, False):
foo = locs['foo']
with warnings.catch_warnings(record=True) as log:
warnings.resetwarnings()
self.assertRaises(TypeError, foo)
- self.assertEqual(len(log), 1)
- self.assertEqual(log[0].category, DeprecationWarning)
+ self.assertEqual(len(log), 0) # no longer warn
def test_called_twice_from_class(self):
import warnings
@@ -749,9 +744,7 @@
exec(CODE, globs, locs)
except TypeError:
if not PYTHON3:
- self.assertEqual(len(log), 2)
- for entry in log:
- self.assertEqual(entry.category, DeprecationWarning)
+ self.assertEqual(len(log), 0) # no longer warn
else:
self.fail("Didn't raise TypeError")
@@ -1155,8 +1148,7 @@
warnings.resetwarnings()
self.assertRaises(TypeError, foo)
if not PYTHON3:
- self.assertEqual(len(log), 1)
- self.assertEqual(log[0].category, DeprecationWarning)
+ self.assertEqual(len(log), 0) # no longer warn
def test_called_twice_from_class(self):
import warnings
@@ -1178,9 +1170,7 @@
exec(CODE, globs, locs)
except TypeError:
if not PYTHON3:
- self.assertEqual(len(log), 2)
- for entry in log:
- self.assertEqual(entry.category, DeprecationWarning)
+ self.assertEqual(len(log), 0) # no longer warn
else:
self.fail("Didn't raise TypeError")
More information about the checkins
mailing list