Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 714e2e1

Browse filesBrowse files
codexByron
andcommitted
Xfail Windows symlink-capable index mutation test
The Windows CI jobs for PR 2140 failed in test/test_index.py::TestIndex::test_index_mutation. The failing checkout path creates my_fake_symlink and Git for Windows 2.54 reports a symlink warning before GitPython raises GitCommandError. This is the same unsupported Windows symlink behavior that the test already marks as an expected failure when core.symlinks is true. Detect Windows hosts that can create symlinks directly and include GitCommandError in the expected failure types, so symlink-capable Windows runners do not fail this unrelated Dependabot PR. Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
1 parent b17f113 commit 714e2e1
Copy full SHA for 714e2e1

1 file changed

+15-2Lines changed: 15 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/test_index.py‎

Copy file name to clipboardExpand all lines: test/test_index.py
+15-2Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ def _decode(stdout):
172172
_win_bash_status = WinBashStatus.check()
173173

174174

175+
def _windows_supports_symlinks():
176+
if sys.platform != "win32":
177+
return False
178+
179+
with tempfile.TemporaryDirectory(prefix="gitpython-symlink-check-") as temp_dir:
180+
link_path = osp.join(temp_dir, "link")
181+
try:
182+
os.symlink("missing-target", link_path)
183+
except (NotImplementedError, OSError):
184+
return False
185+
return S_ISLNK(os.lstat(link_path)[ST_MODE])
186+
187+
175188
def _make_hook(git_dir, name, content, make_exec=True):
176189
"""A helper to create a hook"""
177190
hp = hook_path(name, git_dir)
@@ -553,9 +566,9 @@ def _count_existing(self, repo, files):
553566
# END num existing helper
554567

555568
@pytest.mark.xfail(
556-
sys.platform == "win32" and Git().config("core.symlinks") == "true",
569+
sys.platform == "win32" and (Git().config("core.symlinks") == "true" or _windows_supports_symlinks()),
557570
reason="Assumes symlinks are not created on Windows and opens a symlink to a nonexistent target.",
558-
raises=FileNotFoundError,
571+
raises=(FileNotFoundError, GitCommandError),
559572
)
560573
@with_rw_repo("0.1.6")
561574
def test_index_mutation(self, rw_repo):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.