diff options
Diffstat (limited to 'git/test/test_index.py')
| -rw-r--r-- | git/test/test_index.py | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/git/test/test_index.py b/git/test/test_index.py index 1ffbe9e2..34014064 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): @@ -56,7 +58,7 @@ class TestIndex(TestBase): def _assert_fprogress(self, entries): self.assertEqual(len(entries), len(self._fprogress_map)) - for path, call_count in self._fprogress_map.items(): + for path, call_count in self._fprogress_map.items(): # @UnusedVariable self.assertEqual(call_count, 2) # END for each item in progress map self._reset_progress() @@ -186,7 +188,7 @@ class TestIndex(TestBase): # test BlobFilter prefix = 'lib/git' - for stage, blob in base_index.iter_blobs(BlobFilter([prefix])): + for stage, blob in base_index.iter_blobs(BlobFilter([prefix])): # @UnusedVariable assert blob.path.startswith(prefix) # writing a tree should fail with an unmerged index @@ -410,10 +412,9 @@ class TestIndex(TestBase): uname = u"Thomas Müller" umail = "sd@company.com" - writer = rw_repo.config_writer() - writer.set_value("user", "name", uname) - writer.set_value("user", "email", umail) - writer.release() + with rw_repo.config_writer() as writer: + writer.set_value("user", "name", uname) + writer.set_value("user", "email", umail) self.assertEqual(writer.get_value("user", "name"), uname) # remove all of the files, provide a wild mix of paths, BaseIndexEntries, @@ -821,6 +822,10 @@ class TestIndex(TestBase): asserted = True assert asserted, "Adding using a filename is not correctly asserted." + @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)""") @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) |
