removed mutation of global state, changed filter addition in WarningsRecorder
This commit is contained in:
parent
beaa8e55bd
commit
9f77a8507e
|
@ -37,7 +37,6 @@ def deprecated_call(func=None, *args, **kwargs):
|
||||||
... myobject.deprecated_method()
|
... myobject.deprecated_method()
|
||||||
"""
|
"""
|
||||||
if not func:
|
if not func:
|
||||||
warnings.simplefilter('always')
|
|
||||||
return WarningsChecker(expected_warning=DeprecationWarning)
|
return WarningsChecker(expected_warning=DeprecationWarning)
|
||||||
|
|
||||||
wrec = WarningsRecorder()
|
wrec = WarningsRecorder()
|
||||||
|
@ -158,8 +157,8 @@ class WarningsRecorder(object):
|
||||||
self._module.showwarning = showwarning
|
self._module.showwarning = showwarning
|
||||||
|
|
||||||
# allow the same warning to be raised more than once
|
# allow the same warning to be raised more than once
|
||||||
self._module.simplefilter('always', append=True)
|
|
||||||
|
|
||||||
|
self._module.simplefilter('always')
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, *exc_info):
|
def __exit__(self, *exc_info):
|
||||||
|
|
Loading…
Reference in New Issue