@@ -160,20 +160,22 @@ def test_raising_unittest_skiptest_during_collection_is_deprecated(
160
160
def test_hookproxy_warnings_for_fspath (pytestconfig , tmp_path , request ):
161
161
path = legacy_path (tmp_path )
162
162
163
- with pytest .warns (
164
- PytestDeprecationWarning ,
165
- match = "path : py.path.local is deprecated, please use fspath : pathlib.Path" ,
166
- ):
163
+ PATH_WARN_MATCH = r".*path: py\.path\.local\) argument is deprecated, please use \(fspath: pathlib\.Path.*"
164
+
165
+ with pytest .warns (PytestDeprecationWarning , match = PATH_WARN_MATCH ) as r :
167
166
pytestconfig .hook .pytest_ignore_collect (
168
167
config = pytestconfig , path = path , fspath = tmp_path
169
168
)
170
- with pytest .warns (
171
- PytestDeprecationWarning ,
172
- match = "path : py.path.local is deprecated, please use fspath : pathlib.Path" ,
173
- ):
169
+ (record ,) = r
170
+ assert record .filename == __file__
171
+ assert record .lineno == 166
172
+
173
+ with pytest .warns (PytestDeprecationWarning , match = PATH_WARN_MATCH ) as r :
174
174
request .node .ihook .pytest_ignore_collect (
175
175
config = pytestconfig , path = path , fspath = tmp_path
176
176
)
177
-
177
+ (record ,) = r
178
+ assert record .filename == __file__
179
+ assert record .lineno == 174
178
180
pytestconfig .hook .pytest_ignore_collect (config = pytestconfig , fspath = tmp_path )
179
181
request .node .ihook .pytest_ignore_collect (config = pytestconfig , fspath = tmp_path )
0 commit comments