|
17 | 17 | from sumtypes import constructor, sumtype
|
18 | 18 |
|
19 | 19 | from git import (
|
| 20 | + BlobFilter, |
| 21 | + Diff, |
| 22 | + Git, |
20 | 23 | IndexFile,
|
| 24 | + Object, |
21 | 25 | Repo,
|
22 |
| - BlobFilter, |
23 |
| - UnmergedEntriesError, |
24 | 26 | Tree,
|
25 |
| - Object, |
26 |
| - Diff, |
27 |
| - GitCommandError, |
| 27 | +) |
| 28 | +from git.exc import ( |
28 | 29 | CheckoutError,
|
| 30 | + GitCommandError, |
| 31 | + HookExecutionError, |
| 32 | + InvalidGitRepositoryError, |
| 33 | + UnmergedEntriesError, |
29 | 34 | )
|
30 |
| -from git.exc import HookExecutionError, InvalidGitRepositoryError |
31 | 35 | from git.index.fun import hook_path
|
32 | 36 | from git.index.typ import BaseIndexEntry, IndexEntry
|
33 | 37 | from git.objects import Blob
|
@@ -284,14 +288,6 @@ def add_bad_blob():
|
284 | 288 | except Exception as ex:
|
285 | 289 | assert "index.lock' could not be obtained" not in str(ex)
|
286 | 290 |
|
287 |
| - @pytest.mark.xfail( |
288 |
| - os.name == "nt", |
289 |
| - reason=( |
290 |
| - "IndexFile.from_tree is broken on Windows (related to NamedTemporaryFile), see #1630.\n" |
291 |
| - "'git read-tree --index-output=...' fails with 'fatal: unable to write new index file'." |
292 |
| - ), |
293 |
| - raises=GitCommandError, |
294 |
| - ) |
295 | 291 | @with_rw_repo("0.1.6")
|
296 | 292 | def test_index_file_from_tree(self, rw_repo):
|
297 | 293 | common_ancestor_sha = "5117c9c8a4d3af19a9958677e45cda9269de1541"
|
@@ -342,14 +338,6 @@ def test_index_file_from_tree(self, rw_repo):
|
342 | 338 | # END for each blob
|
343 | 339 | self.assertEqual(num_blobs, len(three_way_index.entries))
|
344 | 340 |
|
345 |
| - @pytest.mark.xfail( |
346 |
| - os.name == "nt", |
347 |
| - reason=( |
348 |
| - "IndexFile.from_tree is broken on Windows (related to NamedTemporaryFile), see #1630.\n" |
349 |
| - "'git read-tree --index-output=...' fails with 'fatal: unable to write new index file'." |
350 |
| - ), |
351 |
| - raises=GitCommandError, |
352 |
| - ) |
353 | 341 | @with_rw_repo("0.1.6")
|
354 | 342 | def test_index_merge_tree(self, rw_repo):
|
355 | 343 | # A bit out of place, but we need a different repo for this:
|
@@ -412,14 +400,6 @@ def test_index_merge_tree(self, rw_repo):
|
412 | 400 | self.assertEqual(len(unmerged_blobs), 1)
|
413 | 401 | self.assertEqual(list(unmerged_blobs.keys())[0], manifest_key[0])
|
414 | 402 |
|
415 |
| - @pytest.mark.xfail( |
416 |
| - os.name == "nt", |
417 |
| - reason=( |
418 |
| - "IndexFile.from_tree is broken on Windows (related to NamedTemporaryFile), see #1630.\n" |
419 |
| - "'git read-tree --index-output=...' fails with 'fatal: unable to write new index file'." |
420 |
| - ), |
421 |
| - raises=GitCommandError, |
422 |
| - ) |
423 | 403 | @with_rw_repo("0.1.6")
|
424 | 404 | def test_index_file_diffing(self, rw_repo):
|
425 | 405 | # Default Index instance points to our index.
|
@@ -555,12 +535,9 @@ def _count_existing(self, repo, files):
|
555 | 535 | # END num existing helper
|
556 | 536 |
|
557 | 537 | @pytest.mark.xfail(
|
558 |
| - os.name == "nt", |
559 |
| - reason=( |
560 |
| - "IndexFile.from_tree is broken on Windows (related to NamedTemporaryFile), see #1630.\n" |
561 |
| - "'git read-tree --index-output=...' fails with 'fatal: unable to write new index file'." |
562 |
| - ), |
563 |
| - raises=GitCommandError, |
| 538 | + os.name == "nt" and Git().config("core.symlinks") == "true", |
| 539 | + reason="Assumes symlinks are not created on Windows and opens a symlink to a nonexistent target.", |
| 540 | + raises=FileNotFoundError, |
564 | 541 | )
|
565 | 542 | @with_rw_repo("0.1.6")
|
566 | 543 | def test_index_mutation(self, rw_repo):
|
@@ -772,7 +749,7 @@ def mixed_iterator():
|
772 | 749 | # END for each target
|
773 | 750 | # END real symlink test
|
774 | 751 |
|
775 |
| - # Add fake symlink and assure it checks-our as symlink. |
| 752 | + # Add fake symlink and assure it checks out as a symlink. |
776 | 753 | fake_symlink_relapath = "my_fake_symlink"
|
777 | 754 | link_target = "/etc/that"
|
778 | 755 | fake_symlink_path = self._make_file(fake_symlink_relapath, link_target, rw_repo)
|
@@ -806,7 +783,7 @@ def mixed_iterator():
|
806 | 783 | os.remove(fake_symlink_path)
|
807 | 784 | index.checkout(fake_symlink_path)
|
808 | 785 |
|
809 |
| - # On Windows, we will never get symlinks. |
| 786 | + # On Windows, we currently assume we will never get symlinks. |
810 | 787 | if os.name == "nt":
|
811 | 788 | # Symlinks should contain the link as text (which is what a
|
812 | 789 | # symlink actually is).
|
@@ -915,14 +892,6 @@ def make_paths():
|
915 | 892 | for absfile in absfiles:
|
916 | 893 | assert osp.isfile(absfile)
|
917 | 894 |
|
918 |
| - @pytest.mark.xfail( |
919 |
| - os.name == "nt", |
920 |
| - reason=( |
921 |
| - "IndexFile.from_tree is broken on Windows (related to NamedTemporaryFile), see #1630.\n" |
922 |
| - "'git read-tree --index-output=...' fails with 'fatal: unable to write new index file'." |
923 |
| - ), |
924 |
| - raises=GitCommandError, |
925 |
| - ) |
926 | 895 | @with_rw_repo("HEAD")
|
927 | 896 | def test_compare_write_tree(self, rw_repo):
|
928 | 897 | """Test writing all trees, comparing them for equality."""
|
|
0 commit comments