Skip to content

Commit 7810405

Browse files
committed
tesr, #519: FIX failures in py2.6 due to missing assertRaisesRegexp
1 parent b3aaf7b commit 7810405

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

git/test/test_index.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import sys
3434
import tempfile
3535
import shutil
36+
from unittest import skipIf
3637
from stat import (
3738
S_ISLNK,
3839
ST_MODE
@@ -135,7 +136,7 @@ def _cmp_tree_index(self, tree, index):
135136
raise AssertionError("CMP Failed: Missing entries in index: %s, missing in tree: %s" %
136137
(bset - iset, iset - bset))
137138
# END assertion message
138-
139+
139140
@with_rw_repo('0.1.6')
140141
def test_index_lock_handling(self, rw_repo):
141142
def add_bad_blob():
@@ -155,6 +156,7 @@ def add_bad_blob():
155156
except Exception as ex:
156157
assert "index.lock' could not be obtained" not in str(ex)
157158

159+
@skipIf(sys.version_info < (2, 7), reason="not `assertRaisesRegexp` in py2.6")
158160
@with_rw_repo('0.1.6')
159161
def test_index_file_from_tree(self, rw_repo):
160162
common_ancestor_sha = "5117c9c8a4d3af19a9958677e45cda9269de1541"
@@ -576,7 +578,7 @@ def mixed_iterator():
576578
if sys.platform != "win32":
577579
for target in ('/etc/nonexisting', '/etc/passwd', '/etc'):
578580
basename = "my_real_symlink"
579-
581+
580582
link_file = os.path.join(rw_repo.working_tree_dir, basename)
581583
os.symlink(target, link_file)
582584
entries = index.reset(new_commit).add([link_file], fprogress=self._fprogress_add)

git/test/test_repo.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from io import BytesIO
5151

5252
from nose import SkipTest
53+
from unittest import skipIf
5354

5455

5556
def iter_flatten(lol):
@@ -106,7 +107,7 @@ def test_tree_from_revision(self):
106107

107108
# try from invalid revision that does not exist
108109
self.failUnlessRaises(BadName, self.rorepo.tree, 'hello world')
109-
110+
110111
def test_pickleable(self):
111112
pickle.loads(pickle.dumps(self.rorepo))
112113

@@ -312,6 +313,7 @@ def test_archive(self):
312313
stream.close()
313314
os.remove(tmpfile)
314315

316+
@skipIf(sys.version_info < (2, 7), reason="not `assertRaisesRegexp` in py2.6")
315317
@patch.object(Git, '_call_process')
316318
def test_should_display_blame_information(self, git):
317319
git.return_value = fixture('blame')

0 commit comments

Comments
 (0)