From aa1799f0de449c50fb5e35ba0befb4ff2fc6f98c Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 24 Oct 2023 09:51:40 -0400 Subject: [PATCH] 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.) --- test/test_util.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/test_util.py b/test/test_util.py index c04f390d1..a02ca0cce 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -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`.""" @@ -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")