From 454576254b873b7ebc45bb30846e5831dc2d8817 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 19 Jul 2021 16:59:30 +0100 Subject: [PATCH] rmv python 3.5 checks from tests --- test/lib/helper.py | 2 +- test/test_base.py | 12 +++++------- test/test_commit.py | 2 +- test/test_git.py | 7 +------ test/test_refs.py | 4 ++-- test/test_remote.py | 4 ++-- test/test_submodule.py | 3 +-- test/test_tree.py | 5 ++--- 8 files changed, 15 insertions(+), 24 deletions(-) diff --git a/test/lib/helper.py b/test/lib/helper.py index 3412786d1..5dde7b04e 100644 --- a/test/lib/helper.py +++ b/test/lib/helper.py @@ -336,7 +336,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/test_base.py b/test/test_base.py index 02963ce0a..68ce68165 100644 --- a/test/test_base.py +++ b/test/test_base.py @@ -9,7 +9,7 @@ import tempfile from unittest import SkipTest, skipIf -from git import ( +from git.objects import ( Blob, Tree, Commit, @@ -18,17 +18,17 @@ 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 @@ def test_with_rw_repo(self, rw_repo): 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 34b91ac7b..670068e50 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -265,7 +265,7 @@ def test_rev_list_bisect_all(self): @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 72c7ef62b..7f52d650f 100644 --- a/test/test_git.py +++ b/test/test_git.py @@ -18,7 +18,6 @@ Repo, cmd ) -from git.compat import is_darwin from test.lib import ( TestBase, fixture_path @@ -248,11 +247,7 @@ def test_environment(self, rw_dir): 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 8ab45d22c..1315f885f 100644 --- a/test/test_refs.py +++ b/test/test_refs.py @@ -119,14 +119,14 @@ def test_heads(self, rwrepo): 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 fb7d23c6c..c29fac65c 100644 --- a/test/test_remote.py +++ b/test/test_remote.py @@ -347,7 +347,7 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo): 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 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo): # 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 85191a896..3307bc788 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 @@ def test_base_rw(self, rwrepo): 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 0607d8e3c..24c401cb6 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 @@ 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 @@ def test_serializable(self): 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')