Skip to content

Commit

Permalink
Fix order of format args with warning
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Nov 7, 2019
1 parent 8aa0809 commit 2e5cf1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/_pytest/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def on_rm_rf_error(func, path: str, exc, *, start_path: Path) -> bool:
warnings.warn(
PytestWarning(
"(rm_rf) unknown function {} when removing {}:\n{}: {}".format(
path, func, exctype, excvalue
func, path, exctype, excvalue
)
)
)
Expand Down
5 changes: 4 additions & 1 deletion testing/test_tmpdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ def test_on_rm_rf_error(self, tmp_path):
assert not on_rm_rf_error(None, str(fn), exc_info, start_path=tmp_path)

# 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)
on_rm_rf_error(None, str(fn), exc_info, start_path=tmp_path)
assert fn.is_file()
Expand Down

0 comments on commit 2e5cf1c

Please sign in to comment.