Skip to content

Commit c785a03

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

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ script:
3232
- ulimit -n 96
3333
- ulimit -n
3434
- nosetests -v --with-coverage
35-
- flake8
36-
- cd doc && make html
35+
- if [ "$TRAVIS_PYTHON_VERSION" != '2.6' ]; then flake8 fi
36+
- if [ "$TRAVIS_PYTHON_VERSION" != '2.6' ]; then cd doc && make html fi
37+
-
3738
after_success:
3839
- coveralls

git/test/test_git.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,18 @@ def counter_stdout(line):
234234
def counter_stderr(line):
235235
count[2] += 1
236236

237+
from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW, SW_HIDE
238+
si = STARTUPINFO()
239+
si.dwFlags = STARTF_USESHOWWINDOW
240+
si.wShowWindow = SW_HIDE
237241
proc = subprocess.Popen([sys.executable, fixture_path('cat_file.py'), str(fixture_path('issue-301_stderr'))],
238242
stdin=None,
239243
stdout=subprocess.PIPE,
240244
stderr=subprocess.PIPE,
241245
shell=False,
242-
creationflags=Git.CREATE_NO_WINDOW if sys.platform == 'win32' else 0,
246+
universal_newlines=True,
247+
# creationflags=Git.CREATE_NO_WINDOW if sys.platform == 'win32' else 0,
248+
# startupinfo=si
243249
)
244250

245251
handle_process_output(proc, counter_stdout, counter_stderr, lambda proc: proc.wait())

git/test/test_index.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _cmp_tree_index(self, tree, index):
135135
raise AssertionError("CMP Failed: Missing entries in index: %s, missing in tree: %s" %
136136
(bset - iset, iset - bset))
137137
# END assertion message
138-
138+
139139
@with_rw_repo('0.1.6')
140140
def test_index_lock_handling(self, rw_repo):
141141
def add_bad_blob():
@@ -157,6 +157,9 @@ def add_bad_blob():
157157

158158
@with_rw_repo('0.1.6')
159159
def test_index_file_from_tree(self, rw_repo):
160+
if sys.version_info < (2, 7):
161+
## Skipped, not `assertRaisesRegexp` in py2.6
162+
return
160163
common_ancestor_sha = "5117c9c8a4d3af19a9958677e45cda9269de1541"
161164
cur_sha = "4b43ca7ff72d5f535134241e7c797ddc9c7a3573"
162165
other_sha = "39f85c4358b7346fee22169da9cad93901ea9eb9"
@@ -576,7 +579,7 @@ def mixed_iterator():
576579
if sys.platform != "win32":
577580
for target in ('/etc/nonexisting', '/etc/passwd', '/etc'):
578581
basename = "my_real_symlink"
579-
582+
580583
link_file = os.path.join(rw_repo.working_tree_dir, basename)
581584
os.symlink(target, link_file)
582585
entries = index.reset(new_commit).add([link_file], fprogress=self._fprogress_add)

git/test/test_repo.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_tree_from_revision(self):
106106

107107
# try from invalid revision that does not exist
108108
self.failUnlessRaises(BadName, self.rorepo.tree, 'hello world')
109-
109+
110110
def test_pickleable(self):
111111
pickle.loads(pickle.dumps(self.rorepo))
112112

@@ -314,6 +314,9 @@ def test_archive(self):
314314

315315
@patch.object(Git, '_call_process')
316316
def test_should_display_blame_information(self, git):
317+
if sys.version_info < (2, 7):
318+
## Skipped, not `assertRaisesRegexp` in py2.6
319+
return
317320
git.return_value = fixture('blame')
318321
b = self.rorepo.blame('master', 'lib/git.py')
319322
assert_equal(13, len(b))

0 commit comments

Comments
 (0)