deprecated_call detects pending warnings again
`deprecated_call` now looks for PendingDeprecationWarnings, as it did previously but was broken by #897. Fixes #1037. Also added a test so this does not happen again.
This commit is contained in:
@@ -81,7 +81,7 @@ def dep_explicit(i):
|
||||
class TestDeprecatedCall(object):
|
||||
def test_deprecated_call_raises(self):
|
||||
excinfo = pytest.raises(AssertionError,
|
||||
"pytest.deprecated_call(dep, 3)")
|
||||
"pytest.deprecated_call(dep, 3)")
|
||||
assert str(excinfo).find("did not produce") != -1
|
||||
|
||||
def test_deprecated_call(self):
|
||||
@@ -105,12 +105,16 @@ class TestDeprecatedCall(object):
|
||||
|
||||
def test_deprecated_explicit_call_raises(self):
|
||||
pytest.raises(AssertionError,
|
||||
"pytest.deprecated_call(dep_explicit, 3)")
|
||||
"pytest.deprecated_call(dep_explicit, 3)")
|
||||
|
||||
def test_deprecated_explicit_call(self):
|
||||
pytest.deprecated_call(dep_explicit, 0)
|
||||
pytest.deprecated_call(dep_explicit, 0)
|
||||
|
||||
def test_deprecated_call_pending(self):
|
||||
f = lambda: py.std.warnings.warn(PendingDeprecationWarning("hi"))
|
||||
pytest.deprecated_call(f)
|
||||
|
||||
|
||||
class TestWarns(object):
|
||||
def test_strings(self):
|
||||
@@ -181,4 +185,3 @@ class TestWarns(object):
|
||||
''')
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(['*2 passed in*'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user