diff options
Diffstat (limited to 'git/test')
-rw-r--r-- | git/test/lib/helper.py | 8 | ||||
-rw-r--r-- | git/test/test_base.py | 5 | ||||
-rw-r--r-- | git/test/test_git.py | 4 | ||||
-rw-r--r-- | git/test/test_index.py | 8 | ||||
-rw-r--r-- | git/test/test_submodule.py | 4 | ||||
-rw-r--r-- | git/test/test_util.py | 5 |
6 files changed, 17 insertions, 17 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 75d4e6fb..7cc1dcae 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -13,7 +13,7 @@ import io import logging from git import Repo, Remote, GitCommandError, Git -from git.compat import string_types +from git.compat import string_types, is_win osp = os.path.dirname @@ -73,7 +73,7 @@ def _mktemp(*args): prefixing /private/ will lead to incorrect paths on OSX.""" tdir = tempfile.mktemp(*args) # See :note: above to learn why this is comented out. - # if sys.platform == 'darwin': + # if is_darwin(): # tdir = '/private' + tdir return tdir @@ -83,7 +83,7 @@ def _rmtree_onerror(osremove, fullpath, exec_info): Handle the case on windows that read-only files cannot be deleted by os.remove by setting it to mode 777, then retry deletion. """ - if os.name != 'nt' or osremove is not os.remove: + if is_win() or osremove is not os.remove: raise os.chmod(fullpath, 0o777) @@ -221,7 +221,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref): if gd is not None: gd.proc.terminate() log.warning('git-ls-remote failed due to: %s(%s)', type(e), e) - if os.name == 'nt': + if is_win(): msg = "git-daemon needs to run this test, but windows does not have one. " msg += 'Otherwise, run: git-daemon "%s"' % temp_dir raise AssertionError(msg) diff --git a/git/test/test_base.py b/git/test/test_base.py index 22006470..cf92997f 100644 --- a/git/test/test_base.py +++ b/git/test/test_base.py @@ -24,6 +24,7 @@ from git import ( ) from git.objects.util import get_object_type_by_name from gitdb.util import hex_to_bin +from git.compat import is_win class TestBase(TestBase): @@ -117,7 +118,7 @@ class TestBase(TestBase): assert rw_remote_repo.config_reader("repository").getboolean("core", "bare") assert os.path.isdir(os.path.join(rw_repo.working_tree_dir, 'lib')) - @skipIf(sys.version_info < (3, ) and os.name == 'nt', + @skipIf(sys.version_info < (3,) and is_win(), "Unicode woes, see https://github.com/gitpython-developers/GitPython/pull/519") @with_rw_repo('0.1.6') def test_add_unicode(self, rw_repo): @@ -134,7 +135,7 @@ class TestBase(TestBase): open(file_path, "wb").write(b'something') - if os.name == 'nt': + if is_win(): # on windows, there is no way this works, see images on # https://github.com/gitpython-developers/GitPython/issues/147#issuecomment-68881897 # Therefore, it must be added using the python implementation diff --git a/git/test/test_git.py b/git/test/test_git.py index ea62de03..2ef15523 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -26,7 +26,7 @@ from git import ( ) from gitdb.test.lib import with_rw_directory -from git.compat import PY3 +from git.compat import PY3, is_darwin try: from unittest import mock @@ -214,7 +214,7 @@ class TestGit(TestBase): try: remote.fetch() except GitCommandError as err: - if sys.version_info[0] < 3 and sys.platform == 'darwin': + if sys.version_info[0] < 3 and is_darwin(): assert 'ssh-origin' in str(err) assert err.status == 128 else: diff --git a/git/test/test_index.py b/git/test/test_index.py index 2ea787a4..b83201c9 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -27,7 +27,7 @@ from git import ( GitCommandError, CheckoutError, ) -from git.compat import string_types +from git.compat import string_types, is_win from gitdb.util import hex_to_bin import os import sys @@ -577,7 +577,7 @@ class TestIndex(TestBase): assert len(entries) == 1 and entries[0].hexsha != null_hex_sha # add symlink - if sys.platform != "win32": + if not is_win(): for target in ('/etc/nonexisting', '/etc/passwd', '/etc'): basename = "my_real_symlink" @@ -630,7 +630,7 @@ class TestIndex(TestBase): index.checkout(fake_symlink_path) # on windows we will never get symlinks - if os.name == 'nt': + if is_win(): # simlinks should contain the link as text ( which is what a # symlink actually is ) open(fake_symlink_path, 'rb').read() == link_target @@ -711,7 +711,7 @@ class TestIndex(TestBase): assert fkey not in index.entries index.add(files, write=True) - if os.name != 'nt': + if is_win(): hp = hook_path('pre-commit', index.repo.git_dir) hpd = os.path.dirname(hp) if not os.path.isdir(hpd): diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 881dd7e6..5906b06c 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -17,7 +17,7 @@ from git.exc import ( 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 +from git.compat import string_types, is_win from git.repo.fun import ( find_git_dir, touch @@ -26,7 +26,7 @@ from git.repo.fun import ( # 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 # closed due to mmap bugs on windows (as it appears) -if sys.platform == 'win32': +if is_win(): try: import smmap.util smmap.util.MapRegion._test_read_into_memory = True diff --git a/git/test/test_util.py b/git/test/test_util.py index 2e53df50..76a5e0e9 100644 --- a/git/test/test_util.py +++ b/git/test/test_util.py @@ -24,10 +24,9 @@ from git.objects.util import ( parse_date, ) from git.cmd import dashify -from git.compat import string_types +from git.compat import string_types, is_win import time -import sys class TestIterableMember(object): @@ -93,7 +92,7 @@ class TestUtils(TestBase): elapsed = time.time() - start # More extra time costs, but... extra_time = 0.2 - if sys.platform == 'win32': + if is_win(): extra_time *= 4 self.assertLess(elapsed, wait_time + 0.02) |