summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cramer <dcramer@gmail.com>2015-12-10 11:24:52 -0800
committerDavid Cramer <dcramer@gmail.com>2015-12-10 11:24:52 -0800
commit95220c99ae6062fed7d4211c67b8dffc031f4c7c (patch)
tree3621ef57a081411a529a2d7cd1caa843f359787e
parent6063125f9ca2a56c5a7f2819732b0e9bafe81c4b (diff)
downloadraven-95220c99ae6062fed7d4211c67b8dffc031f4c7c.tar.gz
Remove use of check_output (not in Py2.6)
-rw-r--r--tests/versioning/tests.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/versioning/tests.py b/tests/versioning/tests.py
index 5949691..a39173c 100644
--- a/tests/versioning/tests.py
+++ b/tests/versioning/tests.py
@@ -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()