From 89b00d714f66cf9cab9863c62978217bf811fed8 Mon Sep 17 00:00:00 2001 From: Pieter Mulder Date: Thu, 25 Jun 2015 14:53:54 +0200 Subject: [PATCH] deprecated_call dit not revert functions back to original Make sure that the warnings.warn and warnings.warn_explicit are reverted to there original function after running the function in deprecated_call --- _pytest/recwarn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_pytest/recwarn.py b/_pytest/recwarn.py index 482b78b0e..875cb510e 100644 --- a/_pytest/recwarn.py +++ b/_pytest/recwarn.py @@ -45,8 +45,8 @@ def deprecated_call(func, *args, **kwargs): try: ret = func(*args, **kwargs) finally: - warnings.warn_explicit = warn_explicit - warnings.warn = warn + warnings.warn_explicit = oldwarn_explicit + warnings.warn = oldwarn if not l: __tracebackhide__ = True raise AssertionError("%r did not produce DeprecationWarning" %(func,))