Skip to content
Prev Previous commit
Next Next commit
Remove file_not_found_tmpdir fixture for TestRmtree
Since its presence doesn't make things any simpler or more elegant.
(It was left over from a previous approach where it was used in
some @DDT parameters.)
  • Loading branch information
EliahKagan committed Nov 3, 2023
commit aa1799f0de449c50fb5e35ba0befb4ff2fc6f98c
10 changes: 3 additions & 7 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ def permission_error_tmpdir(tmp_path):
yield td


@pytest.fixture
def file_not_found_tmpdir(tmp_path):
"""Fixture to test errors deleting a directory that are not due to permissions."""
yield tmp_path / "testdir" # It is deliberately never created.


class TestRmtree:
"""Tests for :func:`git.util.rmtree`."""

Expand Down Expand Up @@ -142,7 +136,9 @@ def test_does_not_wrap_perm_error_unless_enabled(self, mocker, permission_error_
pytest.fail(f"rmtree unexpectedly attempts skip: {ex!r}")

@pytest.mark.parametrize("hide_windows_known_errors", [False, True])
def test_does_not_wrap_other_errors(self, mocker, file_not_found_tmpdir, hide_windows_known_errors):
def test_does_not_wrap_other_errors(self, tmp_path, mocker, hide_windows_known_errors):
file_not_found_tmpdir = tmp_path / "testdir" # It is deliberately never created.

# See comments in test_wraps_perm_error_if_enabled for details about patching.
mocker.patch.object(sys.modules["git.util"], "HIDE_WINDOWS_KNOWN_ERRORS", hide_windows_known_errors)
mocker.patch.object(os, "chmod")
Expand Down