Skip to content

Commit

Permalink
rmv python 3.5 checks from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yobmod committed Jul 19, 2021
1 parent 6609ef7 commit 4545762
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion test/lib/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import tempfile
from unittest import SkipTest, skipIf

from git import (
from git.objects import (
Blob,
Tree,
Commit,
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/test_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
7 changes: 1 addition & 6 deletions test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
Repo,
cmd
)
from git.compat import is_darwin
from test.lib import (
TestBase,
fixture_path
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/test_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,15 @@ 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()
self._do_test_push_result(res, remote)

# 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)
Expand Down
3 changes: 1 addition & 2 deletions test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
5 changes: 2 additions & 3 deletions test/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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')
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 4545762

Please sign in to comment.