Remove use of check_output (not in Py2.6)
This commit is contained in:
parent
6063125f9c
commit
95220c99ae
|
@ -14,13 +14,22 @@ def has_git_requirements():
|
|||
return os.path.exists(os.path.join(settings.PROJECT_ROOT, '.git', 'refs', 'heads', 'master'))
|
||||
|
||||
|
||||
# Python 2.6 does not contain subprocess.check_output
|
||||
def check_output(cmd, **kwargs):
|
||||
return subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
**kwargs
|
||||
).communicate()[0]
|
||||
|
||||
|
||||
@pytest.mark.skipif('not has_git_requirements()')
|
||||
def test_fetch_git_sha():
|
||||
result = fetch_git_sha(settings.PROJECT_ROOT)
|
||||
assert result is not None
|
||||
assert len(result) == 40
|
||||
assert isinstance(result, six.string_types)
|
||||
assert result == subprocess.check_output(
|
||||
assert result == check_output(
|
||||
'git rev-parse --verify HEAD', shell=True, cwd=settings.PROJECT_ROOT
|
||||
).decode('latin1').strip()
|
||||
|
||||
|
|
Loading…
Reference in New Issue