Skip to content

Commit 9ef6b23

Browse files
committed
test: skip tests that need symlink privileges
These called os.symlink unguarded, so on a Windows account without the privilege they errored with WinError 1314 instead of being skipped.
1 parent a02682b commit 9ef6b23

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

test/test_installation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
import os
77
import subprocess
88

9-
from test.lib import TestBase, VirtualEnvironment, with_rw_directory
9+
from test.lib import TestBase, VirtualEnvironment, requires_symlinks, with_rw_directory
1010

1111

1212
class TestInstallation(TestBase):
13+
@requires_symlinks
1314
@with_rw_directory
1415
def test_installation(self, rw_dir):
1516
venv, run = self._set_up_venv(rw_dir)

test/test_repo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from git.repo.fun import touch
4444
from git.util import bin_to_hex, cwd, cygpath, join_path_native, rmfile, rmtree
4545

46-
from test.lib import TestBase, fixture, with_rw_directory, with_rw_repo, PathLikeMock
46+
from test.lib import TestBase, fixture, requires_symlinks, with_rw_directory, with_rw_repo, PathLikeMock
4747

4848

4949
def iter_flatten(lol):
@@ -1351,6 +1351,7 @@ def test_ignored_items_reported(self):
13511351
["included_file.txt", "ignored_file.txt", "included_dir/file.txt", "ignored_dir/file.txt"]
13521352
) == ["ignored_file.txt", "ignored_dir/file.txt"]
13531353

1354+
@requires_symlinks
13541355
def test_ignored_raises_error_w_symlink(self):
13551356
with tempfile.TemporaryDirectory() as tdir:
13561357
tmp_dir = pathlib.Path(tdir)

test/test_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
rmtree,
4141
)
4242

43-
from test.lib import TestBase, with_rw_repo
43+
from test.lib import TestBase, requires_symlinks, with_rw_repo
4444

4545

4646
@pytest.fixture
@@ -113,6 +113,7 @@ def test_deletes_dir_with_readonly_files(self, tmp_path):
113113
sys.platform == "cygwin",
114114
reason="Cygwin can't set the permissions that make the test meaningful.",
115115
)
116+
@requires_symlinks
116117
def test_avoids_changing_permissions_outside_tree(self, tmp_path, request):
117118
# Automatically works on Windows, but on Unix requires either special handling
118119
# or refraining from attempting to fix PermissionError by making chmod calls.

0 commit comments

Comments
 (0)