Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit12bbace

Browse files
committed
Add xfail mark for new test_index_mutation failure
The test assumes symlinks are never created on Windows. This oftenturns out to be correct, because core.symlinks defaults to false onWindows. (On some Windows systems, creating them is a privilegedoperation; this can be reconfigured, and unprivileged creation ofsymlinks is often enabled on systems used for development.)However, on a Windows system with core.symlinks set to true, gitwill create symlinks if it can, when checking out entries committedto a repository as symlinks. GitHub Actions runners for Windows dothis ever sinceactions/runner-images#1186(the file is now at images/windows/scripts/build/Install-Git.ps1;the `/o:EnableSymlinks=Enabled` option continues to be passed,causing Git for Windows to be installed with core.symlinks set totrue in the system scope).For now, this adds an xfail marking to test_index_mutation, for theFileNotFoundError raised when a symlink, which is expected not tobe a symlink, is passed to `open`, causing an attempt to open itsnonexistent target. (The check itself might bear refinement: aswritten, it reads the core.symlinks variable from any scope,including the local scope, which at the time of the check willusually be the cloned GitPython directory, where pytest is run.)While adding an import, this commit also improves the grouping andsorting of existing ones.
1 parentb12fd4a commit12bbace

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

‎test/test_index.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,21 @@
1717
fromsumtypesimportconstructor,sumtype
1818

1919
fromgitimport (
20+
BlobFilter,
21+
Diff,
22+
Git,
2023
IndexFile,
24+
Object,
2125
Repo,
22-
BlobFilter,
23-
UnmergedEntriesError,
2426
Tree,
25-
Object,
26-
Diff,
27-
GitCommandError,
27+
)
28+
fromgit.excimport (
2829
CheckoutError,
30+
GitCommandError,
31+
HookExecutionError,
32+
InvalidGitRepositoryError,
33+
UnmergedEntriesError,
2934
)
30-
fromgit.excimportHookExecutionError,InvalidGitRepositoryError
3135
fromgit.index.funimporthook_path
3236
fromgit.index.typimportBaseIndexEntry,IndexEntry
3337
fromgit.objectsimportBlob
@@ -530,6 +534,11 @@ def _count_existing(self, repo, files):
530534

531535
# END num existing helper
532536

537+
@pytest.mark.xfail(
538+
os.name=="nt"andGit().config("core.symlinks")=="true",
539+
reason="Assumes symlinks are not created on Windows and opens a symlink to a nonexistent target.",
540+
raises=FileNotFoundError,
541+
)
533542
@with_rw_repo("0.1.6")
534543
deftest_index_mutation(self,rw_repo):
535544
index=rw_repo.index
@@ -740,7 +749,7 @@ def mixed_iterator():
740749
# END for each target
741750
# END real symlink test
742751

743-
# Add fake symlink and assure it checks-our as symlink.
752+
# Add fake symlink and assure it checks out as a symlink.
744753
fake_symlink_relapath="my_fake_symlink"
745754
link_target="/etc/that"
746755
fake_symlink_path=self._make_file(fake_symlink_relapath,link_target,rw_repo)
@@ -774,7 +783,7 @@ def mixed_iterator():
774783
os.remove(fake_symlink_path)
775784
index.checkout(fake_symlink_path)
776785

777-
# On Windows, we will never get symlinks.
786+
# On Windows, wecurrently assume wewill never get symlinks.
778787
ifos.name=="nt":
779788
# Symlinks should contain the link as text (which is what a
780789
# symlink actually is).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp