diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-01-07 16:10:03 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-01-07 17:34:18 +0100 |
commit | e876beb4461a35f1a1647bb1f24611e2016353a6 (patch) | |
tree | 6617751f4ce481fd42d73f2476dd31b46a053f28 /tests/testutils.py | |
parent | 49f0e44ac45a77faca1e78d8ce77f73a0d62ddbc (diff) |
tests: adapt dch tests for older devscripts
Determine the default urgency level by determining the version number of
the dch tool from command line.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests/testutils.py')
-rw-r--r-- | tests/testutils.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/testutils.py b/tests/testutils.py index c863195..0b935b7 100644 --- a/tests/testutils.py +++ b/tests/testutils.py @@ -3,6 +3,7 @@ from . import context import os +import subprocess import unittest import gbp.log @@ -87,3 +88,20 @@ class MockedChangeLog(ChangeLog): ChangeLog.__init__(self, contents=self.contents % (version, changes)) + +def get_dch_default_urgency(): + """Determine the default urgency level used by dch""" + try: + popen = subprocess.Popen(['dch', '--version'], stdout=subprocess.PIPE) + out, _err = popen.communicate() + except OSError: + urgency='medium' + else: + verstr = out.splitlines()[0].split()[-1] + major, minor = verstr.split('.')[0:2] + if int(major) <= 2 and int(minor) <= 12: + urgency = 'low' + else: + urgency = 'medium' + return urgency + |