@@ -81,7 +81,7 @@ def dep_explicit(i):
81
81
class TestDeprecatedCall (object ):
82
82
def test_deprecated_call_raises (self ):
83
83
excinfo = pytest .raises (AssertionError ,
84
- "pytest.deprecated_call(dep, 3)" )
84
+ "pytest.deprecated_call(dep, 3)" )
85
85
assert str (excinfo ).find ("did not produce" ) != - 1
86
86
87
87
def test_deprecated_call (self ):
@@ -105,12 +105,24 @@ def test_deprecated_call_preserves(self):
105
105
106
106
def test_deprecated_explicit_call_raises (self ):
107
107
pytest .raises (AssertionError ,
108
- "pytest.deprecated_call(dep_explicit, 3)" )
108
+ "pytest.deprecated_call(dep_explicit, 3)" )
109
109
110
110
def test_deprecated_explicit_call (self ):
111
111
pytest .deprecated_call (dep_explicit , 0 )
112
112
pytest .deprecated_call (dep_explicit , 0 )
113
113
114
+ def test_deprecated_call_pending (self ):
115
+ f = lambda : py .std .warnings .warn (PendingDeprecationWarning ("hi" ))
116
+ pytest .deprecated_call (f )
117
+
118
+ def test_deprecated_call_specificity (self ):
119
+ other_warnings = [Warning , UserWarning , SyntaxWarning , RuntimeWarning ,
120
+ FutureWarning , ImportWarning , UnicodeWarning ]
121
+ for warning in other_warnings :
122
+ f = lambda : py .std .warnings .warn (warning ("hi" ))
123
+ with pytest .raises (AssertionError ):
124
+ pytest .deprecated_call (f )
125
+
114
126
115
127
class TestWarns (object ):
116
128
def test_strings (self ):
@@ -181,4 +193,3 @@ def test(run):
181
193
''' )
182
194
result = testdir .runpytest ()
183
195
result .stdout .fnmatch_lines (['*2 passed in*' ])
184
-
0 commit comments