summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrexlee8776 <limingjiang@huawei.com>2018-10-24 02:49:54 +0000
committerAbhijit Sinha <abhijit.sinha@intel.com>2018-10-26 16:23:25 +0000
commite0b7c0ad95d44eea4db4a3fb532f51688c97c8fc (patch)
tree7c1df9a9bf75b9db304c1e5969bb08e2e4cb7da9
parent626938875d0c4ef9572184028635af05e3778a45 (diff)
fix yardstick verify job
The regex is not compatible with pip version 18. JIRA: INFRA-310 Change-Id: I6eaf1e3fac183f85c277934929e9065efa88d877 Signed-off-by: rexlee8776 <limingjiang@huawei.com> (cherry picked from commit a4084d27de22c64ecb690369c7bed49175703adf)
-rw-r--r--yardstick/tests/functional/common/test_packages.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/yardstick/tests/functional/common/test_packages.py b/yardstick/tests/functional/common/test_packages.py
index 5dead4e55..14de46bcf 100644
--- a/yardstick/tests/functional/common/test_packages.py
+++ b/yardstick/tests/functional/common/test_packages.py
@@ -39,16 +39,21 @@ class PipPackagesTestCase(base.BaseFunctionalTestCase):
utils.execute_command('sudo rm -rf %s' % self.TMP_FOLDER)
def _remove_package(self, package):
- os.system('%s pip uninstall %s -y' % (self.PYTHONPATH, package))
+ os.system('%s python -m pip uninstall %s -y' %
+ (self.PYTHONPATH, package))
def _list_packages(self):
pip_list_regex = re.compile(
r"(?P<name>[\w\.-]+) \((?P<version>[\w\d_\.\-]+),*.*\)")
+ pip_list_regex_18 = re.compile(
+ r"(?P<name>[\w\.-]+)[\s]+(?P<version>[\w\d_\.\-]+),*.*")
pkg_dict = {}
- pkgs = utils.execute_command('pip list',
+ pkgs = utils.execute_command('python -m pip list',
env={'PYTHONPATH': self.TMP_FOLDER})
for line in pkgs:
match = pip_list_regex.match(line)
+ if not match:
+ match = pip_list_regex_18.match(line)
if match and match.group('name'):
pkg_dict[match.group('name')] = match.group('version')
return pkg_dict