diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-03 12:25:09 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-04 01:26:51 +0200 |
commit | be44602b633cfb49a472e192f235ba6de0055d38 (patch) | |
tree | f3bf2cf426e682aba1487174e7e38bd652b09a27 /git/test | |
parent | 86aa8738e0df54971e34f2e929484e0476c7f38a (diff) | |
download | gitpython-be44602b633cfb49a472e192f235ba6de0055d38.tar.gz |
hidden win-errs: Let leaking TCs run till end, then hide
+ Detect code breaking the body of TCs eventually hidden win-errors by
raising SkipTest ALAP.
+ submodule.base.py: import classes from `git.objects` instead of
`utils`.
+ had to ++ ulimit 100->110 for the extra code tested (more leaks :-)
+ Centralize is_win detection.
Diffstat (limited to 'git/test')
-rw-r--r-- | git/test/lib/helper.py | 6 | ||||
-rw-r--r-- | git/test/performance/test_odb.py | 4 | ||||
-rw-r--r-- | git/test/test_docs.py | 9 | ||||
-rw-r--r-- | git/test/test_index.py | 2 | ||||
-rw-r--r-- | git/test/test_repo.py | 8 | ||||
-rw-r--r-- | git/test/test_submodule.py | 16 | ||||
-rw-r--r-- | git/test/test_tree.py | 5 |
7 files changed, 24 insertions, 26 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 36c706dc..3c9374e7 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -14,7 +14,6 @@ import logging from functools import wraps -from git import Repo, Remote, GitCommandError, Git from git.util import rmtree from git.compat import string_types, is_win import textwrap @@ -35,7 +34,7 @@ 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', True)) +HIDE_WINDOWS_KNOWN_ERRORS = is_win and os.environ.get('HIDE_WINDOWS_KNOWN_ERRORS', True) #{ Routines @@ -172,6 +171,7 @@ def with_rw_repo(working_tree_ref, bare=False): def launch_git_daemon(temp_dir, ip, port): + from git import Git if is_win: ## On MINGW-git, daemon exists in .\Git\mingw64\libexec\git-core\, # but if invoked as 'git daemon', it detaches from parent `git` cmd, @@ -217,6 +217,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref): See working dir info in with_rw_repo :note: We attempt to launch our own invocation of git-daemon, which will be shutdown at the end of the test. """ + from git import Remote, GitCommandError assert isinstance(working_tree_ref, string_types), "Decorator requires ref name for working tree checkout" def argument_passer(func): @@ -368,6 +369,7 @@ class TestBase(TestCase): Dynamically add a read-only repository to our actual type. This way each test type has its own repository """ + from git import Repo import gc gc.collect() cls.rorepo = Repo(GIT_REPO) diff --git a/git/test/performance/test_odb.py b/git/test/performance/test_odb.py index 99b550ac..6f07a615 100644 --- a/git/test/performance/test_odb.py +++ b/git/test/performance/test_odb.py @@ -5,7 +5,7 @@ import sys from time import time from unittest.case import skipIf -from git.compat import is_win, PY3 +from git.compat import PY3 from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS from .lib import ( @@ -15,7 +15,7 @@ from .lib import ( class TestObjDBPerformance(TestBigRepoR): - @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and is_win and PY3, + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS 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"]] diff --git a/git/test/test_docs.py b/git/test/test_docs.py index c5be3ce9..6e505dd9 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -5,10 +5,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os -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 @@ -19,9 +16,9 @@ class Tutorials(TestBase): import gc gc.collect() - @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 + # @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, + # "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 26efcb34..c9c68b9e 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -823,7 +823,7 @@ 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""" + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS 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)""") diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 35720fc2..28cc45d9 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -797,7 +797,7 @@ 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(HIDE_WINDOWS_KNOWN_ERRORS and is_win and PY3, + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS 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): @@ -897,9 +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 + # @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, + # "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 64460920..481783a6 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -418,10 +418,10 @@ 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(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 + # @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, + # "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) def test_base_rw(self, rwrepo): self._do_base_tests(rwrepo) @@ -430,7 +430,7 @@ 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, 5), """ + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """ 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') @@ -733,9 +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 + # @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, + # "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 b138bd29..bb62d9bf 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -13,14 +13,13 @@ from git import ( Tree, Blob ) -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, 5), """ + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """ 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') @@ -53,7 +52,7 @@ 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, 5), """ + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """ 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') |