diff options
Diffstat (limited to 'git/test')
-rw-r--r-- | git/test/lib/helper.py | 8 | ||||
-rw-r--r-- | git/test/performance/test_commit.py | 9 | ||||
-rw-r--r-- | git/test/test_commit.py | 12 | ||||
-rw-r--r-- | git/test/test_config.py | 3 | ||||
-rw-r--r-- | git/test/test_index.py | 3 | ||||
-rw-r--r-- | git/test/test_remote.py | 5 | ||||
-rw-r--r-- | git/test/test_repo.py | 3 | ||||
-rw-r--r-- | git/test/test_submodule.py | 3 | ||||
-rw-r--r-- | git/test/test_util.py | 3 |
9 files changed, 32 insertions, 17 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 0ea4fc7e..43079dbe 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -6,13 +6,15 @@ from __future__ import print_function import os import sys -from git import Repo, Remote, GitCommandError, Git from unittest import TestCase import time import tempfile import shutil import io +from git import Repo, Remote, GitCommandError, Git +from git.compat import string_types + GIT_REPO = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) __all__ = ( @@ -89,7 +91,7 @@ def with_rw_repo(working_tree_ref, bare=False): To make working with relative paths easier, the cwd will be set to the working dir of the repository. """ - assert isinstance(working_tree_ref, basestring), "Decorator requires ref name for working tree checkout" + assert isinstance(working_tree_ref, string_types), "Decorator requires ref name for working tree checkout" def argument_passer(func): def repo_creator(self): @@ -152,7 +154,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. """ - assert isinstance(working_tree_ref, basestring), "Decorator requires ref name for working tree checkout" + assert isinstance(working_tree_ref, string_types), "Decorator requires ref name for working tree checkout" def argument_passer(func): def remote_repo_creator(self): diff --git a/git/test/performance/test_commit.py b/git/test/performance/test_commit.py index fed6ef18..a55b6d43 100644 --- a/git/test/performance/test_commit.py +++ b/git/test/performance/test_commit.py @@ -4,13 +4,16 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php from __future__ import print_function +from io import StringIO +from time import time +import sys + from .lib import TestBigRepoRW from git import Commit from gitdb import IStream +from git.compat import xrange from git.test.test_commit import assert_commit_serialization -from io import StringIO -from time import time -import sys + class TestPerformance(TestBigRepoRW): diff --git a/git/test/test_commit.py b/git/test/test_commit.py index 84f81f21..adf1cb10 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -20,6 +20,10 @@ from git import ( ) from gitdb import IStream from gitdb.util import hex_to_bin +from git.compat import ( + string_types, + text_type +) from io import StringIO import time @@ -129,7 +133,7 @@ class TestCommit(TestBase): assert len(name) == 9 special = Actor._from_string(u"%s <something@this.com>" % name) assert special.name == name - assert isinstance(special.name, unicode) + assert isinstance(special.name, text_type) def test_traversal(self): start = self.rorepo.commit("a4d06724202afccd2b5c54f81bcf2bf26dea7fff") @@ -250,7 +254,7 @@ class TestCommit(TestBase): def test_base(self): name_rev = self.rorepo.head.commit.name_rev - assert isinstance(name_rev, basestring) + assert isinstance(name_rev, string_types) @with_rw_repo('HEAD', bare=True) def test_serialization(self, rwrepo): @@ -263,8 +267,8 @@ class TestCommit(TestBase): # create a commit with unicode in the message, and the author's name # Verify its serialization and deserialization cmt = self.rorepo.commit('0.1.6') - assert isinstance(cmt.message, unicode) # it automatically decodes it as such - assert isinstance(cmt.author.name, unicode) # same here + assert isinstance(cmt.message, text_type) # it automatically decodes it as such + assert isinstance(cmt.author.name, text_type) # same here cmt.message = "üäêèß".decode("utf-8") assert len(cmt.message) == 5 diff --git a/git/test/test_config.py b/git/test/test_config.py index d1c8e72f..ef0707e9 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -11,6 +11,7 @@ from git.test.lib import ( from git import ( GitConfigParser ) +from git.compat import string_types import StringIO from copy import copy from ConfigParser import NoSectionError @@ -85,7 +86,7 @@ class TestBase(TestCase): num_options += 1 val = r_config.get(section, option) val_typed = r_config.get_value(section, option) - assert isinstance(val_typed, (bool, long, float, basestring)) + assert isinstance(val_typed, (bool, int, float, ) + string_types) assert val assert "\n" not in option assert "\n" not in val diff --git a/git/test/test_index.py b/git/test/test_index.py index 74bdac53..70d70a05 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -20,6 +20,7 @@ from git import ( GitCommandError, CheckoutError, ) +from git.compat import string_types from gitdb.util import hex_to_bin import os import sys @@ -343,7 +344,7 @@ class TestIndex(TestBase): index.checkout(test_file) except CheckoutError as e: assert len(e.failed_files) == 1 and e.failed_files[0] == os.path.basename(test_file) - assert (len(e.failed_files) == len(e.failed_reasons)) and isinstance(e.failed_reasons[0], basestring) + assert (len(e.failed_files) == len(e.failed_reasons)) and isinstance(e.failed_reasons[0], string_types) assert len(e.valid_files) == 0 assert open(test_file).read().endswith(append_data) else: diff --git a/git/test/test_remote.py b/git/test/test_remote.py index a8d5179a..75dc19c5 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -23,6 +23,7 @@ from git import ( GitCommandError ) from git.util import IterableList +from git.compat import string_types import tempfile import shutil import os @@ -97,7 +98,7 @@ class TestRemote(TestBase): # self._print_fetchhead(remote.repo) assert len(results) > 0 and isinstance(results[0], FetchInfo) for info in results: - assert isinstance(info.note, basestring) + assert isinstance(info.note, string_types) if isinstance(info.ref, Reference): assert info.flags != 0 # END reference type flags handling @@ -113,7 +114,7 @@ class TestRemote(TestBase): assert len(results) > 0 and isinstance(results[0], PushInfo) for info in results: assert info.flags - assert isinstance(info.summary, basestring) + assert isinstance(info.summary, string_types) if info.old_commit is not None: assert isinstance(info.old_commit, Commit) if info.flags & info.ERROR: diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 41c1c8f1..f33fe467 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -30,6 +30,7 @@ from git import ( from git.util import join_path_native from git.exc import BadObject from gitdb.util import bin_to_hex +from git.compat import string_types import os import sys @@ -286,7 +287,7 @@ class TestRepo(TestBase): # test the 'lines per commit' entries tlist = b[0][1] assert_true(tlist) - assert_true(isinstance(tlist[0], basestring)) + assert_true(isinstance(tlist[0], string_types)) assert_true(len(tlist) < sum(len(t) for t in tlist)) # test for single-char bug def test_blame_real(self): diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index ec3459e4..8c1580fe 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -9,6 +9,7 @@ from git.exc import InvalidGitRepositoryError 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 import shutil import git import sys @@ -76,7 +77,7 @@ class TestSubmodule(TestBase): self.failUnlessRaises(InvalidGitRepositoryError, getattr, sm, 'branch') # branch_path works, as its just a string - assert isinstance(sm.branch_path, basestring) + assert isinstance(sm.branch_path, string_types) # some commits earlier we still have a submodule, but its at a different commit smold = Submodule.iter_items(rwrepo, self.k_subm_changed).next() diff --git a/git/test/test_util.py b/git/test/test_util.py index 888eb4ee..c6ca6920 100644 --- a/git/test/test_util.py +++ b/git/test/test_util.py @@ -24,6 +24,7 @@ from git.objects.util import ( parse_date, ) from git.cmd import dashify +from git.compat import string_types import time @@ -104,7 +105,7 @@ class TestUtils(TestBase): # now that we are here, test our conversion functions as well utctz = altz_to_utctz_str(offset) - assert isinstance(utctz, basestring) + assert isinstance(utctz, string_types) assert utctz_to_altz(verify_utctz(utctz)) == offset # END assert rval utility |