From 6df78b19b7786b15c664a7a1e0bcbb3e7c80f8da Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Mon, 3 Oct 2016 03:22:18 +0200 Subject: 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. --- git/test/lib/helper.py | 5 ++++ git/test/performance/lib.py | 1 + git/test/performance/test_odb.py | 4 +++- git/test/test_docs.py | 7 ++++++ git/test/test_index.py | 50 ++++++++++++++++++++++------------------ git/test/test_repo.py | 11 ++++++--- git/test/test_submodule.py | 32 ++++++++++++++++--------- git/test/test_tree.py | 20 +++++++++++++--- 8 files changed, 90 insertions(+), 40 deletions(-) diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 4335a977..d3d3ba29 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -32,6 +32,11 @@ __all__ = ( log = logging.getLogger('git.util') +#: We need an easy way to see if Appveyor TCs start failing, +#: so the errors marked with this var are considered "acknowledged" ones, awaiting remedy, +#: till then, we wish to hide them. +HIDE_WINDOWS_KNOWN_ERRORS = bool(os.environ.get('HIDE_WINDOWS_KNOWN_ERRORS', False)) + #{ Routines diff --git a/git/test/performance/lib.py b/git/test/performance/lib.py index eebbfd76..0c4c20a4 100644 --- a/git/test/performance/lib.py +++ b/git/test/performance/lib.py @@ -19,6 +19,7 @@ from git.util import rmtree #{ Invvariants k_env_git_repo = "GIT_PYTHON_TEST_GIT_REPO_BASE" + #} END invariants diff --git a/git/test/performance/test_odb.py b/git/test/performance/test_odb.py index 9abe2d42..99b550ac 100644 --- a/git/test/performance/test_odb.py +++ b/git/test/performance/test_odb.py @@ -6,6 +6,7 @@ from time import time from unittest.case import skipIf from git.compat import is_win, PY3 +from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS from .lib import ( TestBigRepoR @@ -14,7 +15,8 @@ from .lib import ( class TestObjDBPerformance(TestBigRepoR): - @skipIf(is_win and PY3, "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly") + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and PY3, + "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly") def test_random_access(self): results = [["Iterate Commits"], ["Iterate Blobs"], ["Retrieve Blob Data"]] for repo in (self.gitrorepo, self.puregitrorepo): diff --git a/git/test/test_docs.py b/git/test/test_docs.py index 8a2dff0f..84112c1d 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -5,7 +5,11 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os +import sys +from unittest.case import skipIf +from git.compat import is_win +from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS from git.test.lib import TestBase from git.test.lib.helper import with_rw_directory @@ -16,6 +20,9 @@ class Tutorials(TestBase): import gc gc.collect() + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] in ((2, 7), (3, 4)), + "FIXME: helper.wrapper fails with: PermissionError: [WinError 5] Access is denied: " + "'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_work_tree_unsupportedryfa60di\\master_repo\\.git\\objects\\pack\\pack-bc9e0787aef9f69e1591ef38ea0a6f566ec66fe3.idx") # noqa E501 @with_rw_directory def test_init_repo_object(self, rw_dir): # [1-test_init_repo_object] diff --git a/git/test/test_index.py b/git/test/test_index.py index 1ffbe9e2..26efcb34 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -5,17 +5,16 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import ( - TestBase, - fixture_path, - fixture, - with_rw_repo -) -from git.util import Actor, rmtree -from git.exc import ( - HookExecutionError, - InvalidGitRepositoryError +from io import BytesIO +import os +from stat import ( + S_ISLNK, + ST_MODE ) +import sys +import tempfile +from unittest.case import skipIf + from git import ( IndexFile, Repo, @@ -28,24 +27,27 @@ from git import ( CheckoutError, ) from git.compat import string_types, is_win -from gitdb.util import hex_to_bin -import os -import sys -import tempfile -from stat import ( - S_ISLNK, - ST_MODE +from git.exc import ( + HookExecutionError, + InvalidGitRepositoryError ) - -from io import BytesIO -from gitdb.base import IStream -from git.objects import Blob +from git.index.fun import hook_path from git.index.typ import ( BaseIndexEntry, IndexEntry ) -from git.index.fun import hook_path +from git.objects import Blob +from git.test.lib import ( + TestBase, + fixture_path, + fixture, + with_rw_repo +) +from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS from git.test.lib import with_rw_directory +from git.util import Actor, rmtree +from gitdb.base import IStream +from gitdb.util import hex_to_bin class TestIndex(TestBase): @@ -821,6 +823,10 @@ class TestIndex(TestBase): asserted = True assert asserted, "Adding using a filename is not correctly asserted." + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (2, 7), r""" + FIXME: File "C:\projects\gitpython\git\util.py", line 125, in to_native_path_linux + return path.replace('\\', '/') + UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)""") @with_rw_directory def test_add_utf8P_path(self, rw_dir): # NOTE: fp is not a Unicode object in python 2 (which is the source of the problem) diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 7c96cc48..35720fc2 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -7,11 +7,11 @@ import glob from io import BytesIO import itertools -import functools as fnt import os import pickle import sys import tempfile +from unittest.case import skipIf from git import ( InvalidGitRepositoryError, @@ -50,13 +50,14 @@ from git.test.lib import ( assert_true, raises ) +from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS from git.test.lib import with_rw_directory from git.util import join_path_native, rmtree, rmfile from gitdb.util import bin_to_hex from nose import SkipTest +import functools as fnt import os.path as osp -from unittest.case import skipIf def iter_flatten(lol): @@ -796,7 +797,8 @@ class TestRepo(TestBase): git_file_repo = Repo(rwrepo.working_tree_dir) self.assertEqual(os.path.abspath(git_file_repo.git_dir), real_path_abs) - @skipIf(is_win and PY3, "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly") + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and PY3, + "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly") def test_file_handle_leaks(self): def last_commit(repo, rev, path): commit = next(repo.iter_commits(rev, path, max_count=1)) @@ -895,6 +897,9 @@ class TestRepo(TestBase): for i, j in itertools.permutations([c1, 'ffffff', ''], r=2): self.assertRaises(GitCommandError, repo.is_ancestor, i, j) + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win, + "FIXME: helper.wrapper fails with: PermissionError: [WinError 5] Access is denied: " + "'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_work_tree_unsupportedryfa60di\\master_repo\\.git\\objects\\pack\\pack-bc9e0787aef9f69e1591ef38ea0a6f566ec66fe3.idx") # noqa E501 @with_rw_directory def test_work_tree_unsupported(self, rw_dir): git = Git(rw_dir) diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 6dcf1831..b0b2d4e2 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -1,28 +1,29 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -import sys import os +import sys +from unittest.case import skipIf import git - -from git.test.lib import ( - TestBase, - with_rw_repo -) -from git.test.lib import with_rw_directory +from git.compat import string_types, is_win from git.exc import ( InvalidGitRepositoryError, RepositoryDirtyError ) from git.objects.submodule.base import Submodule from git.objects.submodule.root import RootModule, RootUpdateProgress -from git.util import to_native_path_linux, join_path_native -from git.compat import string_types, is_win from git.repo.fun import ( find_git_dir, touch ) -from unittest.case import skipIf +from git.test.lib import ( + TestBase, + with_rw_repo +) +from git.test.lib import with_rw_directory +from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS +from git.util import to_native_path_linux, join_path_native + # Change the configuration if possible to prevent the underlying memory manager # to keep file handles open. On windows we get problems as they are not properly @@ -417,7 +418,8 @@ class TestSubmodule(TestBase): # Error if there is no submodule file here self.failUnlessRaises(IOError, Submodule._config_parser, rwrepo, rwrepo.commit(self.k_no_subm_tag), True) - @skipIf(is_win, "FIXME: fails with: PermissionError: [WinError 32] The process cannot access the file because" + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win, + "FIXME: fails with: PermissionError: [WinError 32] The process cannot access the file because" "it is being used by another process: " "'C:\\Users\\ankostis\\AppData\\Local\\Temp\\tmp95c3z83bnon_bare_test_base_rw\\git\\ext\\gitdb\\gitdb\\ext\\smmap'") # noqa E501 @with_rw_repo(k_subm_current) @@ -428,6 +430,11 @@ class TestSubmodule(TestBase): def test_base_bare(self, rwrepo): self._do_base_tests(rwrepo) + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (3, 4), """ + File "C:\projects\gitpython\git\cmd.py", line 559, in execute + raise GitCommandNotFound(command, err) + git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid') + cmdline: git clone -n --shared -v C:\projects\gitpython\.git Users\appveyor\AppData\Local\Temp\1\tmplyp6kr_rnon_bare_test_root_module""") # noqa E501 @with_rw_repo(k_subm_current, bare=False) def test_root_module(self, rwrepo): # Can query everything without problems @@ -726,6 +733,9 @@ class TestSubmodule(TestBase): assert commit_sm.binsha == sm_too.binsha assert sm_too.binsha != sm.binsha + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win, + "FIXME: helper.wrapper fails with: PermissionError: [WinError 5] Access is denied: " + "'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_work_tree_unsupportedryfa60di\\master_repo\\.git\\objects\\pack\\pack-bc9e0787aef9f69e1591ef38ea0a6f566ec66fe3.idx") # noqa E501 @with_rw_directory def test_git_submodule_compatibility(self, rwdir): parent = git.Repo.init(os.path.join(rwdir, 'parent')) diff --git a/git/test/test_tree.py b/git/test/test_tree.py index f9282411..1e0a5122 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -4,18 +4,27 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php +from io import BytesIO import os -from git.test.lib import TestBase +import sys +from unittest.case import skipIf + from git import ( Tree, Blob ) - -from io import BytesIO +from git.compat import is_win +from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS +from git.test.lib import TestBase class TestTree(TestBase): + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (3, 4), """ + File "C:\projects\gitpython\git\cmd.py", line 559, in execute + raise GitCommandNotFound(command, err) + git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid') + cmdline: git cat-file --batch-check""") def test_serializable(self): # tree at the given commit contains a submodule as well roottree = self.rorepo.tree('6c1faef799095f3990e9970bc2cb10aa0221cf9c') @@ -44,6 +53,11 @@ class TestTree(TestBase): testtree._deserialize(stream) # END for each item in tree + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and sys.version_info[:2] == (3, 4), """ + File "C:\projects\gitpython\git\cmd.py", line 559, in execute + raise GitCommandNotFound(command, err) + git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid') + cmdline: git cat-file --batch-check""") def test_traverse(self): root = self.rorepo.tree('0.1.6') num_recursive = 0 -- cgit v1.2.1