[svn r38459] two functions with the same name, use the latter one.
--HG-- branch : trunk
This commit is contained in:
parent
4e66510fa7
commit
e068a463a1
|
@ -1,27 +1,9 @@
|
||||||
import py
|
import py
|
||||||
|
|
||||||
def deprecated_call(func, *args, **kwargs):
|
def deprecated_call(func, *args, **kwargs):
|
||||||
""" assert that calling func(*args, **kwargs)
|
""" assert that calling func(*args, **kwargs)
|
||||||
triggers a DeprecationWarning.
|
triggers a DeprecationWarning.
|
||||||
"""
|
"""
|
||||||
oldfilters = py.std.warnings.filters[:]
|
|
||||||
onceregistry = py.std.warnings.onceregistry.copy()
|
|
||||||
try:
|
|
||||||
py.std.warnings.onceregistry.clear()
|
|
||||||
py.std.warnings.filterwarnings("error", category=DeprecationWarning)
|
|
||||||
try:
|
|
||||||
_ = func(*args, **kwargs)
|
|
||||||
except DeprecationWarning:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
print __warningregistry__
|
|
||||||
raise AssertionError("%s not deprecated" % (func,))
|
|
||||||
finally:
|
|
||||||
py.std.warnings.filters[:] = oldfilters
|
|
||||||
py.std.warnings.onceregistry.clear()
|
|
||||||
py.std.warnings.onceregistry.update(onceregistry)
|
|
||||||
|
|
||||||
def deprecated_call(func, *args, **kwargs):
|
|
||||||
l = []
|
l = []
|
||||||
oldwarn = py.std.warnings.warn_explicit
|
oldwarn = py.std.warnings.warn_explicit
|
||||||
def warn_explicit(*args, **kwargs):
|
def warn_explicit(*args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue