removed mutation of global state, changed filter addition in WarningsRecorder

This commit is contained in:
Galaczi Endre 2015-09-21 15:54:50 +01:00
parent beaa8e55bd
commit 9f77a8507e
1 changed files with 1 additions and 2 deletions

View File

@ -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):