From 3b1cfcc629e856b1384b811b8cf30b92a1e34fe1 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Fri, 14 Oct 2016 16:43:52 +0200 Subject: cygwin, #533: Allow '/cygdrive/c/' paths on repo init - Cygwin TCs failing: - PY2: err: 13, fail: 2 - PY3: err: 12, fail: 2 --- git/test/test_repo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'git/test/test_repo.py') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index a0a6a5b0..314201ea 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -50,7 +50,7 @@ from git.test.lib import ( assert_true, raises ) -from git.util import HIDE_WINDOWS_KNOWN_ERRORS +from git.util import HIDE_WINDOWS_KNOWN_ERRORS, cygpath from git.test.lib import with_rw_directory from git.util import join_path_native, rmtree, rmfile from gitdb.util import bin_to_hex @@ -913,6 +913,8 @@ class TestRepo(TestBase): rw_master = self.rorepo.clone(join_path_native(rw_dir, 'master_repo')) rw_master.git.checkout('HEAD~10') worktree_path = join_path_native(rw_dir, 'worktree_repo') + if Git.is_cygwin(): + worktree_path = cygpath(worktree_path) try: rw_master.git.worktree('add', worktree_path, 'master') except Exception as ex: -- cgit v1.2.1 From 0210e394e0776d0b7097bf666bebd690ed0c0e4f Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Sat, 15 Oct 2016 13:11:16 +0200 Subject: src: import os.path as osp --- git/test/test_repo.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'git/test/test_repo.py') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 314201ea..4b21db4b 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -203,8 +203,8 @@ class TestRepo(TestBase): prev_cwd = os.getcwd() os.chdir(tempfile.gettempdir()) git_dir_rela = "repos/foo/bar.git" - del_dir_abs = os.path.abspath("repos") - git_dir_abs = os.path.abspath(git_dir_rela) + del_dir_abs = osp.abspath("repos") + git_dir_abs = osp.abspath(git_dir_rela) try: # with specific path for path in (git_dir_rela, git_dir_abs): @@ -212,7 +212,7 @@ class TestRepo(TestBase): self.assertIsInstance(r, Repo) assert r.bare is True assert not r.has_separate_working_tree() - assert os.path.isdir(r.git_dir) + assert osp.isdir(r.git_dir) self._assert_empty_repo(r) @@ -306,16 +306,16 @@ class TestRepo(TestBase): def test_is_dirty_with_path(self, rwrepo): assert rwrepo.is_dirty(path="git") is False - with open(os.path.join(rwrepo.working_dir, "git", "util.py"), "at") as f: + with open(osp.join(rwrepo.working_dir, "git", "util.py"), "at") as f: f.write("junk") assert rwrepo.is_dirty(path="git") is True assert rwrepo.is_dirty(path="doc") is False - rwrepo.git.add(os.path.join("git", "util.py")) + rwrepo.git.add(osp.join("git", "util.py")) assert rwrepo.is_dirty(index=False, path="git") is False assert rwrepo.is_dirty(path="git") is True - with open(os.path.join(rwrepo.working_dir, "doc", "no-such-file.txt"), "wt") as f: + with open(osp.join(rwrepo.working_dir, "doc", "no-such-file.txt"), "wt") as f: f.write("junk") assert rwrepo.is_dirty(path="doc") is False assert rwrepo.is_dirty(untracked_files=True, path="doc") is True @@ -494,10 +494,10 @@ class TestRepo(TestBase): ph = os.environ.get('HOME') try: os.environ['HOME'] = rw_dir - Repo.init(os.path.join('~', 'test.git'), bare=True) + Repo.init(osp.join('~', 'test.git'), bare=True) os.environ['FOO'] = rw_dir - Repo.init(os.path.join('$FOO', 'test.git'), bare=True) + Repo.init(osp.join('$FOO', 'test.git'), bare=True) finally: if ph: os.environ['HOME'] = ph @@ -785,7 +785,7 @@ class TestRepo(TestBase): @with_rw_repo('HEAD') def test_git_file(self, rwrepo): # Move the .git directory to another location and create the .git file. - real_path_abs = os.path.abspath(join_path_native(rwrepo.working_tree_dir, '.real')) + real_path_abs = osp.abspath(join_path_native(rwrepo.working_tree_dir, '.real')) os.rename(rwrepo.git_dir, real_path_abs) git_file_path = join_path_native(rwrepo.working_tree_dir, '.git') with open(git_file_path, 'wb') as fp: @@ -793,13 +793,13 @@ class TestRepo(TestBase): # Create a repo and make sure it's pointing to the relocated .git directory. git_file_repo = Repo(rwrepo.working_tree_dir) - self.assertEqual(os.path.abspath(git_file_repo.git_dir), real_path_abs) + self.assertEqual(osp.abspath(git_file_repo.git_dir), real_path_abs) # Test using an absolute gitdir path in the .git file. with open(git_file_path, 'wb') as fp: fp.write(('gitdir: %s\n' % real_path_abs).encode('ascii')) git_file_repo = Repo(rwrepo.working_tree_dir) - self.assertEqual(os.path.abspath(git_file_repo.git_dir), real_path_abs) + self.assertEqual(osp.abspath(git_file_repo.git_dir), real_path_abs) @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and PY3, "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly") @@ -840,7 +840,7 @@ class TestRepo(TestBase): # It's expected to not be able to access a tree self.failUnlessRaises(ValueError, r.tree) - new_file_path = os.path.join(rw_dir, "new_file.ext") + new_file_path = osp.join(rw_dir, "new_file.ext") touch(new_file_path) r.index.add([new_file_path]) r.index.commit("initial commit\nBAD MESSAGE 1\n") -- cgit v1.2.1 From b02662d4e870a34d2c6d97d4f702fcc1311e5177 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Sat, 15 Oct 2016 13:42:33 +0200 Subject: src: reduce needless deps to `gitdb.util` --- git/test/test_repo.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'git/test/test_repo.py') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 4b21db4b..495c4337 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -52,8 +52,7 @@ from git.test.lib import ( ) from git.util import HIDE_WINDOWS_KNOWN_ERRORS, cygpath 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 git.util import join_path_native, rmtree, rmfile, bin_to_hex from unittest import SkipTest import functools as fnt -- cgit v1.2.1 From 4486bcbbf49ad0eacf2d8229fb0e7e3432f440d9 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Sat, 15 Oct 2016 14:52:40 +0200 Subject: ci, deps: no PY26, ddt>=1.1.1, CIs `pip install test-requirements` + Use environment-markers in requirement files (see http://stackoverflow.com/a/33451105/548792). --- git/test/test_repo.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'git/test/test_repo.py') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 495c4337..11c720e9 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -900,9 +900,6 @@ 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, - # "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) -- cgit v1.2.1 From b2efa1b19061ad6ed9d683ba98a88b18bff3bfd9 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Sun, 16 Oct 2016 02:44:37 +0200 Subject: cygwin, #533: FIX submodules detection (~10TCs fixed) + Decygpath sm's `.git` file contents. + Polish another path in `git add`; actually no main-code changes, just a replace \-->/ on a relative(!) path to make cygwin-git to work. - REGRESSION `test_git_submodules_and_add_sm_with_new_commit` asks for user/email settings. - Cygwin TCs failing: - PY2: err: 2, fail: 1 - PY3: err: 2, fail: 1 --- git/test/test_repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test/test_repo.py') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 11c720e9..95bc8a96 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -310,7 +310,7 @@ class TestRepo(TestBase): assert rwrepo.is_dirty(path="git") is True assert rwrepo.is_dirty(path="doc") is False - rwrepo.git.add(osp.join("git", "util.py")) + rwrepo.git.add(Git.polish_url(osp.join("git", "util.py"))) assert rwrepo.is_dirty(index=False, path="git") is False assert rwrepo.is_dirty(path="git") is True -- cgit v1.2.1 From 5962373da1444d841852970205bff77d5ca9377f Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Sun, 16 Oct 2016 22:02:51 +0200 Subject: cygwin, appveyor, #533: Enable actual failures, hide certain 2+2 cases --- git/test/test_repo.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'git/test/test_repo.py') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 95bc8a96..8b644f7f 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -411,6 +411,14 @@ class TestRepo(TestBase): self.assertEqual(len(res), 1) self.assertEqual(len(res[0][1]), 83, "Unexpected amount of parsed blame lines") + @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and Git.is_cygwin(), + """FIXME: File "C:\projects\gitpython\git\cmd.py", line 671, in execute + raise GitCommandError(command, status, stderr_value, stdout_value) + GitCommandError: Cmd('git') failed due to: exit code(128) + cmdline: git add 1__��ava verb��ten 1_test _myfile 1_test_other_file + 1_��ava-----verb��ten + stderr: 'fatal: pathspec '"1__çava verböten"' did not match any files' + """) @with_rw_repo('HEAD', bare=False) def test_untracked_files(self, rwrepo): for run, (repo_add, is_invoking_git) in enumerate(( -- cgit v1.2.1