Fix order of format args with warning

This commit is contained in:
Daniel Hahler 2019-10-28 12:34:40 +01:00
parent 8aa0809fbc
commit 2e5cf1cc78
2 changed files with 5 additions and 2 deletions

View File

@ -72,7 +72,7 @@ def on_rm_rf_error(func, path: str, exc, *, start_path: Path) -> bool:
warnings.warn( warnings.warn(
PytestWarning( PytestWarning(
"(rm_rf) unknown function {} when removing {}:\n{}: {}".format( "(rm_rf) unknown function {} when removing {}:\n{}: {}".format(
path, func, exctype, excvalue func, path, exctype, excvalue
) )
) )
) )

View File

@ -388,7 +388,10 @@ class TestRmRf:
assert not on_rm_rf_error(None, str(fn), exc_info, start_path=tmp_path) assert not on_rm_rf_error(None, str(fn), exc_info, start_path=tmp_path)
# unknown function # unknown function
with pytest.warns(pytest.PytestWarning): with pytest.warns(
pytest.PytestWarning,
match=r"^\(rm_rf\) unknown function None when removing .*foo.txt:\nNone: ",
):
exc_info = (None, PermissionError(), None) exc_info = (None, PermissionError(), None)
on_rm_rf_error(None, str(fn), exc_info, start_path=tmp_path) on_rm_rf_error(None, str(fn), exc_info, start_path=tmp_path)
assert fn.is_file() assert fn.is_file()