summaryrefslogtreecommitdiff
path: root/src/zope/interface/tests
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2012-05-22 20:00:35 +0000
committerTres Seaver <tseaver@palladion.com>2012-05-22 20:00:35 +0000
commit5147747a00d7b680e0972a2e80098c4273a88289 (patch)
tree04b585f906569242046f7e1c68d0fa0fb2821a86 /src/zope/interface/tests
parent74c589cd62c6c204fbe6c7836577fa127f2a3b19 (diff)
downloadzope-interface-5147747a00d7b680e0972a2e80098c4273a88289.tar.gz
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.
Diffstat (limited to 'src/zope/interface/tests')
-rw-r--r--src/zope/interface/tests/test_declarations.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/zope/interface/tests/test_declarations.py b/src/zope/interface/tests/test_declarations.py
index a2f120e..49991d0 100644
--- a/src/zope/interface/tests/test_declarations.py
+++ b/src/zope/interface/tests/test_declarations.py
@@ -34,17 +34,14 @@ class _Py3ClassAdvice(object):
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 @@ class Test_implementsOnly(_SilencePy3Deprecations, _Py3ClassAdvice):
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 Test_implementsOnly(_SilencePy3Deprecations, _Py3ClassAdvice):
'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 @@ class Test_implements(_SilencePy3Deprecations, _Py3ClassAdvice):
'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 @@ class Test_implements(_SilencePy3Deprecations, _Py3ClassAdvice):
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 @@ class Test_classProvides(_SilencePy3Deprecations, _Py3ClassAdvice):
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 @@ class Test_classProvides(_SilencePy3Deprecations, _Py3ClassAdvice):
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")