summaryrefslogtreecommitdiff
path: root/tests/testutils/site.py
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2019-01-29 14:58:44 +0000
committerChandan Singh <chandan@chandansingh.net>2019-01-31 14:32:44 +0000
commitdd791373f684c1faed8829ef426477b76185364e (patch)
tree4b64cf66aee4caa9f3778e60b3712adc1a85e413 /tests/testutils/site.py
parentfa4a21ce3f04f411c5af20052fff48a17115acbd (diff)
downloadbuildstream-dd791373f684c1faed8829ef426477b76185364e.tar.gz
testutils/site.py: Support parsing more exotic git versions
We use output of `git --version` to determine if we can run some tests that rely on features from newer git versions. Usually, we expect the output to be like: git version 2.17.2 On some platforms, like MacOS, there could be a suffix after the version string, so that it looks something like: git version 2.17.2 (Apple Git-113) This causes things to fail like so: ValueError: invalid literal for int() with base 10: '2 (Apple Git-113)\n' Fix logic around `HAVE_OLD_GIT` such that we split the output of `git --version` without limit on how many times we split. Previously we used to split only twice so the suffixes like `(Apple Git-113)` are not part of the parsed version.
Diffstat (limited to 'tests/testutils/site.py')
-rw-r--r--tests/testutils/site.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/testutils/site.py b/tests/testutils/site.py
index b7bfa11cf..31bcffbca 100644
--- a/tests/testutils/site.py
+++ b/tests/testutils/site.py
@@ -18,7 +18,7 @@ try:
utils.get_host_tool('git')
HAVE_GIT = True
out = str(subprocess.check_output(['git', '--version']), "utf-8")
- version = tuple(int(x) for x in out.split(' ', 2)[2].split('.'))
+ version = tuple(int(x) for x in out.split(' ')[2].split('.'))
HAVE_OLD_GIT = version < (1, 8, 5)
except ProgramNotFoundError:
HAVE_GIT = False