Skip to content

Commit 6df78b1

Browse files
committed
Appveyor: Add and set HIDE_WINDOWS_KNOWN_ERRORS=False
+ Collect all "acknowledged" failing TCs on Appveyor and use "HIDE_WINDOWS_KNOWN_ERRORS" var to hide them.
1 parent 1b44082 commit 6df78b1

File tree

8 files changed

+90
-40
lines changed

8 files changed

+90
-40
lines changed

Diff for: git/test/lib/helper.py

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232

3333
log = logging.getLogger('git.util')
3434

35+
#: We need an easy way to see if Appveyor TCs start failing,
36+
#: so the errors marked with this var are considered "acknowledged" ones, awaiting remedy,
37+
#: till then, we wish to hide them.
38+
HIDE_WINDOWS_KNOWN_ERRORS = bool(os.environ.get('HIDE_WINDOWS_KNOWN_ERRORS', False))
39+
3540
#{ Routines
3641

3742

Diff for: git/test/performance/lib.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#{ Invvariants
2121
k_env_git_repo = "GIT_PYTHON_TEST_GIT_REPO_BASE"
22+
2223
#} END invariants
2324

2425

Diff for: git/test/performance/test_odb.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from unittest.case import skipIf
77

88
from git.compat import is_win, PY3
9+
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
910

1011
from .lib import (
1112
TestBigRepoR
@@ -14,7 +15,8 @@
1415

1516
class TestObjDBPerformance(TestBigRepoR):
1617

17-
@skipIf(is_win and PY3, "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly")
18+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and PY3,
19+
"FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly")
1820
def test_random_access(self):
1921
results = [["Iterate Commits"], ["Iterate Blobs"], ["Retrieve Blob Data"]]
2022
for repo in (self.gitrorepo, self.puregitrorepo):

Diff for: git/test/test_docs.py

+7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
# This module is part of GitPython and is released under
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
77
import os
8+
import sys
9+
from unittest.case import skipIf
810

11+
from git.compat import is_win
12+
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
913
from git.test.lib import TestBase
1014
from git.test.lib.helper import with_rw_directory
1115

@@ -16,6 +20,9 @@ def tearDown(self):
1620
import gc
1721
gc.collect()
1822

23+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] in ((2, 7), (3, 4)),
24+
"FIXME: helper.wrapper fails with: PermissionError: [WinError 5] Access is denied: "
25+
"'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_work_tree_unsupportedryfa60di\\master_repo\\.git\\objects\\pack\\pack-bc9e0787aef9f69e1591ef38ea0a6f566ec66fe3.idx") # noqa E501
1926
@with_rw_directory
2027
def test_init_repo_object(self, rw_dir):
2128
# [1-test_init_repo_object]

Diff for: git/test/test_index.py

+28-22
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
# This module is part of GitPython and is released under
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
77

8-
from git.test.lib import (
9-
TestBase,
10-
fixture_path,
11-
fixture,
12-
with_rw_repo
13-
)
14-
from git.util import Actor, rmtree
15-
from git.exc import (
16-
HookExecutionError,
17-
InvalidGitRepositoryError
8+
from io import BytesIO
9+
import os
10+
from stat import (
11+
S_ISLNK,
12+
ST_MODE
1813
)
14+
import sys
15+
import tempfile
16+
from unittest.case import skipIf
17+
1918
from git import (
2019
IndexFile,
2120
Repo,
@@ -28,24 +27,27 @@
2827
CheckoutError,
2928
)
3029
from git.compat import string_types, is_win
31-
from gitdb.util import hex_to_bin
32-
import os
33-
import sys
34-
import tempfile
35-
from stat import (
36-
S_ISLNK,
37-
ST_MODE
30+
from git.exc import (
31+
HookExecutionError,
32+
InvalidGitRepositoryError
3833
)
39-
40-
from io import BytesIO
41-
from gitdb.base import IStream
42-
from git.objects import Blob
34+
from git.index.fun import hook_path
4335
from git.index.typ import (
4436
BaseIndexEntry,
4537
IndexEntry
4638
)
47-
from git.index.fun import hook_path
39+
from git.objects import Blob
40+
from git.test.lib import (
41+
TestBase,
42+
fixture_path,
43+
fixture,
44+
with_rw_repo
45+
)
46+
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
4847
from git.test.lib import with_rw_directory
48+
from git.util import Actor, rmtree
49+
from gitdb.base import IStream
50+
from gitdb.util import hex_to_bin
4951

5052

5153
class TestIndex(TestBase):
@@ -821,6 +823,10 @@ def test_index_bare_add(self, rw_bare_repo):
821823
asserted = True
822824
assert asserted, "Adding using a filename is not correctly asserted."
823825

826+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (2, 7), r"""
827+
FIXME: File "C:\projects\gitpython\git\util.py", line 125, in to_native_path_linux
828+
return path.replace('\\', '/')
829+
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)""")
824830
@with_rw_directory
825831
def test_add_utf8P_path(self, rw_dir):
826832
# NOTE: fp is not a Unicode object in python 2 (which is the source of the problem)

Diff for: git/test/test_repo.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import glob
88
from io import BytesIO
99
import itertools
10-
import functools as fnt
1110
import os
1211
import pickle
1312
import sys
1413
import tempfile
14+
from unittest.case import skipIf
1515

1616
from git import (
1717
InvalidGitRepositoryError,
@@ -50,13 +50,14 @@
5050
assert_true,
5151
raises
5252
)
53+
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
5354
from git.test.lib import with_rw_directory
5455
from git.util import join_path_native, rmtree, rmfile
5556
from gitdb.util import bin_to_hex
5657
from nose import SkipTest
5758

59+
import functools as fnt
5860
import os.path as osp
59-
from unittest.case import skipIf
6061

6162

6263
def iter_flatten(lol):
@@ -796,7 +797,8 @@ def test_git_file(self, rwrepo):
796797
git_file_repo = Repo(rwrepo.working_tree_dir)
797798
self.assertEqual(os.path.abspath(git_file_repo.git_dir), real_path_abs)
798799

799-
@skipIf(is_win and PY3, "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly")
800+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and PY3,
801+
"FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly")
800802
def test_file_handle_leaks(self):
801803
def last_commit(repo, rev, path):
802804
commit = next(repo.iter_commits(rev, path, max_count=1))
@@ -895,6 +897,9 @@ def test_is_ancestor(self):
895897
for i, j in itertools.permutations([c1, 'ffffff', ''], r=2):
896898
self.assertRaises(GitCommandError, repo.is_ancestor, i, j)
897899

900+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win,
901+
"FIXME: helper.wrapper fails with: PermissionError: [WinError 5] Access is denied: "
902+
"'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_work_tree_unsupportedryfa60di\\master_repo\\.git\\objects\\pack\\pack-bc9e0787aef9f69e1591ef38ea0a6f566ec66fe3.idx") # noqa E501
898903
@with_rw_directory
899904
def test_work_tree_unsupported(self, rw_dir):
900905
git = Git(rw_dir)

Diff for: git/test/test_submodule.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
# This module is part of GitPython and is released under
22
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
3-
import sys
43
import os
4+
import sys
5+
from unittest.case import skipIf
56

67
import git
7-
8-
from git.test.lib import (
9-
TestBase,
10-
with_rw_repo
11-
)
12-
from git.test.lib import with_rw_directory
8+
from git.compat import string_types, is_win
139
from git.exc import (
1410
InvalidGitRepositoryError,
1511
RepositoryDirtyError
1612
)
1713
from git.objects.submodule.base import Submodule
1814
from git.objects.submodule.root import RootModule, RootUpdateProgress
19-
from git.util import to_native_path_linux, join_path_native
20-
from git.compat import string_types, is_win
2115
from git.repo.fun import (
2216
find_git_dir,
2317
touch
2418
)
25-
from unittest.case import skipIf
19+
from git.test.lib import (
20+
TestBase,
21+
with_rw_repo
22+
)
23+
from git.test.lib import with_rw_directory
24+
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
25+
from git.util import to_native_path_linux, join_path_native
26+
2627

2728
# Change the configuration if possible to prevent the underlying memory manager
2829
# to keep file handles open. On windows we get problems as they are not properly
@@ -417,7 +418,8 @@ def _do_base_tests(self, rwrepo):
417418
# Error if there is no submodule file here
418419
self.failUnlessRaises(IOError, Submodule._config_parser, rwrepo, rwrepo.commit(self.k_no_subm_tag), True)
419420

420-
@skipIf(is_win, "FIXME: fails with: PermissionError: [WinError 32] The process cannot access the file because"
421+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win,
422+
"FIXME: fails with: PermissionError: [WinError 32] The process cannot access the file because"
421423
"it is being used by another process: "
422424
"'C:\\Users\\ankostis\\AppData\\Local\\Temp\\tmp95c3z83bnon_bare_test_base_rw\\git\\ext\\gitdb\\gitdb\\ext\\smmap'") # noqa E501
423425
@with_rw_repo(k_subm_current)
@@ -428,6 +430,11 @@ def test_base_rw(self, rwrepo):
428430
def test_base_bare(self, rwrepo):
429431
self._do_base_tests(rwrepo)
430432

433+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (3, 4), """
434+
File "C:\projects\gitpython\git\cmd.py", line 559, in execute
435+
raise GitCommandNotFound(command, err)
436+
git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid')
437+
cmdline: git clone -n --shared -v C:\projects\gitpython\.git Users\appveyor\AppData\Local\Temp\1\tmplyp6kr_rnon_bare_test_root_module""") # noqa E501
431438
@with_rw_repo(k_subm_current, bare=False)
432439
def test_root_module(self, rwrepo):
433440
# Can query everything without problems
@@ -726,6 +733,9 @@ def test_git_submodules_and_add_sm_with_new_commit(self, rwdir):
726733
assert commit_sm.binsha == sm_too.binsha
727734
assert sm_too.binsha != sm.binsha
728735

736+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win,
737+
"FIXME: helper.wrapper fails with: PermissionError: [WinError 5] Access is denied: "
738+
"'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_work_tree_unsupportedryfa60di\\master_repo\\.git\\objects\\pack\\pack-bc9e0787aef9f69e1591ef38ea0a6f566ec66fe3.idx") # noqa E501
729739
@with_rw_directory
730740
def test_git_submodule_compatibility(self, rwdir):
731741
parent = git.Repo.init(os.path.join(rwdir, 'parent'))

Diff for: git/test/test_tree.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7+
from io import BytesIO
78
import os
8-
from git.test.lib import TestBase
9+
import sys
10+
from unittest.case import skipIf
11+
912
from git import (
1013
Tree,
1114
Blob
1215
)
13-
14-
from io import BytesIO
16+
from git.compat import is_win
17+
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
18+
from git.test.lib import TestBase
1519

1620

1721
class TestTree(TestBase):
1822

23+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (3, 4), """
24+
File "C:\projects\gitpython\git\cmd.py", line 559, in execute
25+
raise GitCommandNotFound(command, err)
26+
git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid')
27+
cmdline: git cat-file --batch-check""")
1928
def test_serializable(self):
2029
# tree at the given commit contains a submodule as well
2130
roottree = self.rorepo.tree('6c1faef799095f3990e9970bc2cb10aa0221cf9c')
@@ -44,6 +53,11 @@ def test_serializable(self):
4453
testtree._deserialize(stream)
4554
# END for each item in tree
4655

56+
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (3, 4), """
57+
File "C:\projects\gitpython\git\cmd.py", line 559, in execute
58+
raise GitCommandNotFound(command, err)
59+
git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid')
60+
cmdline: git cat-file --batch-check""")
4761
def test_traverse(self):
4862
root = self.rorepo.tree('0.1.6')
4963
num_recursive = 0

0 commit comments

Comments
 (0)