Split warns matching string in multiple lines

This commit is contained in:
Olga Matoula 2021-05-17 09:23:08 +01:00
parent 2414d23c78
commit dd8ad3fa9c
1 changed files with 4 additions and 1 deletions

View File

@ -183,7 +183,10 @@ def test_hookproxy_warnings_for_fspath(tmp_path, hooktype, request):
def test_warns_none_is_deprecated():
with pytest.warns(
PytestDeprecationWarning,
match=r"Passing None to catch any warning has been deprecated, pass no arguments instead:\n Replace pytest.warns\(None\) by simply pytest.warns\(\).",
match=re.escape(
"Passing None to catch any warning has been deprecated, pass no arguments instead:\n "
"Replace pytest.warns(None) by simply pytest.warns()."
),
):
with pytest.warns(None):
pass