summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2021-07-20 07:04:18 +0800
committerGitHub <noreply@github.com>2021-07-20 07:04:18 +0800
commitcfd653aeeb3cb807f2cd2ae9fff5568880ac67da (patch)
tree8514389e82efdcdcdeaab5d3a85553883f28117c /test
parentacbd6bad9ded9a1d59e80e71d334d64b0244f5cd (diff)
parent600df043e76924d43a4f9f88f4e3241740f34c77 (diff)
downloadgitpython-cfd653aeeb3cb807f2cd2ae9fff5568880ac67da.tar.gz
Merge pull request #1295 from Yobmod/main
Add types to refs
Diffstat (limited to 'test')
-rw-r--r--test/lib/helper.py4
-rw-r--r--test/performance/test_commit.py1
-rw-r--r--test/performance/test_odb.py2
-rw-r--r--test/performance/test_streams.py2
-rw-r--r--test/test_base.py12
-rw-r--r--test/test_commit.py4
-rw-r--r--test/test_git.py7
-rw-r--r--test/test_refs.py4
-rw-r--r--test/test_remote.py4
-rw-r--r--test/test_submodule.py3
-rw-r--r--test/test_tree.py5
11 files changed, 15 insertions, 33 deletions
diff --git a/test/lib/helper.py b/test/lib/helper.py
index 3412786d..632d6af9 100644
--- a/test/lib/helper.py
+++ b/test/lib/helper.py
@@ -3,8 +3,6 @@
#
# 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
-
import contextlib
from functools import wraps
import gc
@@ -336,7 +334,7 @@ class TestBase(TestCase):
- Class level repository which is considered read-only as it is shared among
all test cases in your type.
Access it using::
- self.rorepo # 'ro' stands for read-only
+ self.rorepo # 'ro' stands for read-only
The rorepo is in fact your current project's git repo. If you refer to specific
shas for your objects, be sure you choose some that are part of the immutable portion
diff --git a/test/performance/test_commit.py b/test/performance/test_commit.py
index 4617b052..8158a1e6 100644
--- a/test/performance/test_commit.py
+++ b/test/performance/test_commit.py
@@ -3,7 +3,6 @@
#
# 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 BytesIO
from time import time
import sys
diff --git a/test/performance/test_odb.py b/test/performance/test_odb.py
index 8bd614f2..c9521c56 100644
--- a/test/performance/test_odb.py
+++ b/test/performance/test_odb.py
@@ -1,6 +1,4 @@
"""Performance tests for object store"""
-from __future__ import print_function
-
import sys
from time import time
diff --git a/test/performance/test_streams.py b/test/performance/test_streams.py
index edf32c91..28e6b13e 100644
--- a/test/performance/test_streams.py
+++ b/test/performance/test_streams.py
@@ -1,6 +1,4 @@
"""Performance data streaming performance"""
-from __future__ import print_function
-
import os
import subprocess
import sys
diff --git a/test/test_base.py b/test/test_base.py
index 02963ce0..68ce6816 100644
--- a/test/test_base.py
+++ b/test/test_base.py
@@ -9,7 +9,7 @@ import sys
import tempfile
from unittest import SkipTest, skipIf
-from git import (
+from git.objects import (
Blob,
Tree,
Commit,
@@ -18,17 +18,17 @@ from git import (
from git.compat import is_win
from git.objects.util import get_object_type_by_name
from test.lib import (
- TestBase,
+ TestBase as _TestBase,
with_rw_repo,
with_rw_and_rw_remote_repo
)
-from git.util import hex_to_bin
+from git.util import hex_to_bin, HIDE_WINDOWS_FREEZE_ERRORS
import git.objects.base as base
import os.path as osp
-class TestBase(TestBase):
+class TestBase(_TestBase):
def tearDown(self):
import gc
@@ -111,15 +111,13 @@ class TestBase(TestBase):
assert not rw_repo.config_reader("repository").getboolean("core", "bare")
assert osp.isdir(osp.join(rw_repo.working_tree_dir, 'lib'))
- #@skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes! sometimes...")
+ @skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes! sometimes...")
@with_rw_and_rw_remote_repo('0.1.6')
def test_with_rw_remote_and_rw_repo(self, rw_repo, rw_remote_repo):
assert not rw_repo.config_reader("repository").getboolean("core", "bare")
assert rw_remote_repo.config_reader("repository").getboolean("core", "bare")
assert osp.isdir(osp.join(rw_repo.working_tree_dir, 'lib'))
- @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):
filename = "שלום.txt"
diff --git a/test/test_commit.py b/test/test_commit.py
index 34b91ac7..67dc7d73 100644
--- a/test/test_commit.py
+++ b/test/test_commit.py
@@ -4,8 +4,6 @@
#
# 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 datetime import datetime
from io import BytesIO
import re
@@ -265,7 +263,7 @@ class TestCommit(TestCommitSerialization):
@with_rw_directory
def test_ambiguous_arg_iteration(self, rw_dir):
rw_repo = Repo.init(osp.join(rw_dir, 'test_ambiguous_arg'))
- path = osp.join(rw_repo.working_tree_dir, 'master')
+ path = osp.join(str(rw_repo.working_tree_dir), 'master')
touch(path)
rw_repo.index.add([path])
rw_repo.index.commit('initial commit')
diff --git a/test/test_git.py b/test/test_git.py
index 72c7ef62..7f52d650 100644
--- a/test/test_git.py
+++ b/test/test_git.py
@@ -18,7 +18,6 @@ from git import (
Repo,
cmd
)
-from git.compat import is_darwin
from test.lib import (
TestBase,
fixture_path
@@ -248,11 +247,7 @@ class TestGit(TestBase):
try:
remote.fetch()
except GitCommandError as err:
- if sys.version_info[0] < 3 and is_darwin:
- self.assertIn('ssh-orig', str(err))
- self.assertEqual(err.status, 128)
- else:
- self.assertIn('FOO', str(err))
+ self.assertIn('FOO', str(err))
def test_handle_process_output(self):
from git.cmd import handle_process_output
diff --git a/test/test_refs.py b/test/test_refs.py
index 8ab45d22..1315f885 100644
--- a/test/test_refs.py
+++ b/test/test_refs.py
@@ -119,14 +119,14 @@ class TestRefs(TestBase):
assert head.tracking_branch() == remote_ref
head.set_tracking_branch(None)
assert head.tracking_branch() is None
-
+
special_name = 'feature#123'
special_name_remote_ref = SymbolicReference.create(rwrepo, 'refs/remotes/origin/%s' % special_name)
gp_tracking_branch = rwrepo.create_head('gp_tracking#123')
special_name_remote_ref = rwrepo.remotes[0].refs[special_name] # get correct type
gp_tracking_branch.set_tracking_branch(special_name_remote_ref)
assert gp_tracking_branch.tracking_branch().path == special_name_remote_ref.path
-
+
git_tracking_branch = rwrepo.create_head('git_tracking#123')
rwrepo.git.branch('-u', special_name_remote_ref.name, git_tracking_branch.name)
assert git_tracking_branch.tracking_branch().name == special_name_remote_ref.name
diff --git a/test/test_remote.py b/test/test_remote.py
index fb7d23c6..c29fac65 100644
--- a/test/test_remote.py
+++ b/test/test_remote.py
@@ -347,7 +347,7 @@ class TestRemote(TestBase):
progress = TestRemoteProgress()
to_be_updated = "my_tag.1.0RV"
new_tag = TagReference.create(rw_repo, to_be_updated) # @UnusedVariable
- other_tag = TagReference.create(rw_repo, "my_obj_tag.2.1aRV", message="my message")
+ other_tag = TagReference.create(rw_repo, "my_obj_tag.2.1aRV", logmsg="my message")
res = remote.push(progress=progress, tags=True)
self.assertTrue(res[-1].flags & PushInfo.NEW_TAG)
progress.make_assertion()
@@ -355,7 +355,7 @@ class TestRemote(TestBase):
# update push new tags
# Rejection is default
- new_tag = TagReference.create(rw_repo, to_be_updated, ref='HEAD~1', force=True)
+ new_tag = TagReference.create(rw_repo, to_be_updated, reference='HEAD~1', force=True)
res = remote.push(tags=True)
self._do_test_push_result(res, remote)
self.assertTrue(res[-1].flags & PushInfo.REJECTED)
diff --git a/test/test_submodule.py b/test/test_submodule.py
index 85191a89..3307bc78 100644
--- a/test/test_submodule.py
+++ b/test/test_submodule.py
@@ -3,7 +3,6 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os
import shutil
-import sys
from unittest import skipIf
import git
@@ -421,7 +420,7 @@ class TestSubmodule(TestBase):
def test_base_bare(self, rwrepo):
self._do_base_tests(rwrepo)
- @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """
+ @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """
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')
diff --git a/test/test_tree.py b/test/test_tree.py
index 0607d8e3..24c401cb 100644
--- a/test/test_tree.py
+++ b/test/test_tree.py
@@ -5,7 +5,6 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from io import BytesIO
-import sys
from unittest import skipIf
from git.objects import (
@@ -20,7 +19,7 @@ import os.path as osp
class TestTree(TestBase):
- @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """
+ @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """
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 sys.version_info[:2] == (3, 5), """
+ @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """
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')