rmv python 3.5 checks from tests · gitpython-developers/GitPython@4545762

8 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -336,7 +336,7 @@ class TestBase(TestCase):

336336

- Class level repository which is considered read-only as it is shared among

337337

all test cases in your type.

338338

Access it using::

339-

self.rorepo # 'ro' stands for read-only

339+

self.rorepo # 'ro' stands for read-only

340340
341341

The rorepo is in fact your current project's git repo. If you refer to specific

342342

shas for your objects, be sure you choose some that are part of the immutable portion

Original file line numberDiff line numberDiff line change

@@ -9,7 +9,7 @@

99

import tempfile

1010

from unittest import SkipTest, skipIf

1111
12-

from git import (

12+

from git.objects import (

1313

Blob,

1414

Tree,

1515

Commit,

@@ -18,17 +18,17 @@

1818

from git.compat import is_win

1919

from git.objects.util import get_object_type_by_name

2020

from test.lib import (

21-

TestBase,

21+

TestBase as _TestBase,

2222

with_rw_repo,

2323

with_rw_and_rw_remote_repo

2424

)

25-

from git.util import hex_to_bin

25+

from git.util import hex_to_bin, HIDE_WINDOWS_FREEZE_ERRORS

2626
2727

import git.objects.base as base

2828

import os.path as osp

2929
3030
31-

class TestBase(TestBase):

31+

class TestBase(_TestBase):

3232
3333

def tearDown(self):

3434

import gc

@@ -111,15 +111,13 @@ def test_with_rw_repo(self, rw_repo):

111111

assert not rw_repo.config_reader("repository").getboolean("core", "bare")

112112

assert osp.isdir(osp.join(rw_repo.working_tree_dir, 'lib'))

113113
114-

#@skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes! sometimes...")

114+

@skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes! sometimes...")

115115

@with_rw_and_rw_remote_repo('0.1.6')

116116

def test_with_rw_remote_and_rw_repo(self, rw_repo, rw_remote_repo):

117117

assert not rw_repo.config_reader("repository").getboolean("core", "bare")

118118

assert rw_remote_repo.config_reader("repository").getboolean("core", "bare")

119119

assert osp.isdir(osp.join(rw_repo.working_tree_dir, 'lib'))

120120
121-

@skipIf(sys.version_info < (3,) and is_win,

122-

"Unicode woes, see https://github.com/gitpython-developers/GitPython/pull/519")

123121

@with_rw_repo('0.1.6')

124122

def test_add_unicode(self, rw_repo):

125123

filename = "שלום.txt"

Original file line numberDiff line numberDiff line change

@@ -265,7 +265,7 @@ def test_rev_list_bisect_all(self):

265265

@with_rw_directory

266266

def test_ambiguous_arg_iteration(self, rw_dir):

267267

rw_repo = Repo.init(osp.join(rw_dir, 'test_ambiguous_arg'))

268-

path = osp.join(rw_repo.working_tree_dir, 'master')

268+

path = osp.join(str(rw_repo.working_tree_dir), 'master')

269269

touch(path)

270270

rw_repo.index.add([path])

271271

rw_repo.index.commit('initial commit')

Original file line numberDiff line numberDiff line change

@@ -18,7 +18,6 @@

1818

Repo,

1919

cmd

2020

)

21-

from git.compat import is_darwin

2221

from test.lib import (

2322

TestBase,

2423

fixture_path

@@ -248,11 +247,7 @@ def test_environment(self, rw_dir):

248247

try:

249248

remote.fetch()

250249

except GitCommandError as err:

251-

if sys.version_info[0] < 3 and is_darwin:

252-

self.assertIn('ssh-orig', str(err))

253-

self.assertEqual(err.status, 128)

254-

else:

255-

self.assertIn('FOO', str(err))

250+

self.assertIn('FOO', str(err))

256251
257252

def test_handle_process_output(self):

258253

from git.cmd import handle_process_output

Original file line numberDiff line numberDiff line change

@@ -119,14 +119,14 @@ def test_heads(self, rwrepo):

119119

assert head.tracking_branch() == remote_ref

120120

head.set_tracking_branch(None)

121121

assert head.tracking_branch() is None

122-
122+
123123

special_name = 'feature#123'

124124

special_name_remote_ref = SymbolicReference.create(rwrepo, 'refs/remotes/origin/%s' % special_name)

125125

gp_tracking_branch = rwrepo.create_head('gp_tracking#123')

126126

special_name_remote_ref = rwrepo.remotes[0].refs[special_name] # get correct type

127127

gp_tracking_branch.set_tracking_branch(special_name_remote_ref)

128128

assert gp_tracking_branch.tracking_branch().path == special_name_remote_ref.path

129-
129+
130130

git_tracking_branch = rwrepo.create_head('git_tracking#123')

131131

rwrepo.git.branch('-u', special_name_remote_ref.name, git_tracking_branch.name)

132132

assert git_tracking_branch.tracking_branch().name == special_name_remote_ref.name

Original file line numberDiff line numberDiff line change

@@ -347,15 +347,15 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):

347347

progress = TestRemoteProgress()

348348

to_be_updated = "my_tag.1.0RV"

349349

new_tag = TagReference.create(rw_repo, to_be_updated) # @UnusedVariable

350-

other_tag = TagReference.create(rw_repo, "my_obj_tag.2.1aRV", message="my message")

350+

other_tag = TagReference.create(rw_repo, "my_obj_tag.2.1aRV", logmsg="my message")

351351

res = remote.push(progress=progress, tags=True)

352352

self.assertTrue(res[-1].flags & PushInfo.NEW_TAG)

353353

progress.make_assertion()

354354

self._do_test_push_result(res, remote)

355355
356356

# update push new tags

357357

# Rejection is default

358-

new_tag = TagReference.create(rw_repo, to_be_updated, ref='HEAD~1', force=True)

358+

new_tag = TagReference.create(rw_repo, to_be_updated, reference='HEAD~1', force=True)

359359

res = remote.push(tags=True)

360360

self._do_test_push_result(res, remote)

361361

self.assertTrue(res[-1].flags & PushInfo.REJECTED)

Original file line numberDiff line numberDiff line change

@@ -3,7 +3,6 @@

33

# the BSD License: http://www.opensource.org/licenses/bsd-license.php

44

import os

55

import shutil

6-

import sys

76

from unittest import skipIf

87
98

import git

@@ -421,7 +420,7 @@ def test_base_rw(self, rwrepo):

421420

def test_base_bare(self, rwrepo):

422421

self._do_base_tests(rwrepo)

423422
424-

@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """

423+

@skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """

425424

File "C:\\projects\\gitpython\\git\\cmd.py", line 559, in execute

426425

raise GitCommandNotFound(command, err)

427426

git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid')

Original file line numberDiff line numberDiff line change

@@ -5,7 +5,6 @@

55

# the BSD License: http://www.opensource.org/licenses/bsd-license.php

66
77

from io import BytesIO

8-

import sys

98

from unittest import skipIf

109
1110

from git.objects import (

@@ -20,7 +19,7 @@

2019
2120

class TestTree(TestBase):

2221
23-

@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """

22+

@skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """

2423

File "C:\\projects\\gitpython\\git\\cmd.py", line 559, in execute

2524

raise GitCommandNotFound(command, err)

2625

git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid')

@@ -53,7 +52,7 @@ def test_serializable(self):

5352

testtree._deserialize(stream)

5453

# END for each item in tree

5554
56-

@skipIf(HIDE_WINDOWS_KNOWN_ERRORS and sys.version_info[:2] == (3, 5), """

55+

@skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """

5756

File "C:\\projects\\gitpython\\git\\cmd.py", line 559, in execute

5857

raise GitCommandNotFound(command, err)

5958

git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid')