Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Marc Schlaich
Mark Abramowitz
Martijn Faassen
Nicolas Delaby
Pieter Mulder
Piotr Banaszkiewicz
Punyashloka Biswal
Ralf Schmitt
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
2.7.2 (compared to 2.7.1)
-----------------------------

- preserve warning functions after call to pytest.deprecated_call
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a "Thanks Pieter Mulder for PR." to the end, as we usually do with the other entries. Thanks


- fix issue767: pytest.raises value attribute does not contain the exception
instance on Python 2.6. Thanks Eric Siegerman for providing the test
case and Bruno Oliveira for PR.
Expand Down
4 changes: 2 additions & 2 deletions _pytest/recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def warn(*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,))
Expand Down
8 changes: 4 additions & 4 deletions testing/test_recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def test_deprecated_call_ret():
assert ret == 42

def test_deprecated_call_preserves():
r = py.std.warnings.onceregistry.copy()
f = py.std.warnings.filters[:]
warn = py.std.warnings.warn
warn_explicit = py.std.warnings.warn_explicit
test_deprecated_call_raises()
test_deprecated_call()
assert r == py.std.warnings.onceregistry
assert f == py.std.warnings.filters
assert warn == py.std.warnings.warn
assert warn_explicit == py.std.warnings.warn_explicit

def test_deprecated_explicit_call_raises():
pytest.raises(AssertionError,
Expand Down