Explicitly install tox package

Tox is used to run tempest so explicitly install the tox package

Change-Id: Ifc802a7d76208d6f2818e0f2e09e7fc5ad4d7f52
Closes-Bug: 1648493
This commit is contained in:
Liam Young 2016-12-12 15:58:48 +00:00
parent 603778a6f1
commit 2d054f6bb9
2 changed files with 22 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import urllib
import charms_openstack.charm as charm
import charms_openstack.adapters as adapters
import charmhelpers.core.hookenv as hookenv
import charmhelpers.core.host as host
import charmhelpers.fetch as fetch
@ -320,6 +321,15 @@ class TempestCharm(charm.OpenStackCharm):
PIP_CONF: [],
}
@property
def all_packages(self):
_packages = self.packages[:]
if host.lsb_release()['DISTRIB_RELEASE'] > '14.04':
_packages.append('tox')
else:
_packages.append('python-tox')
return _packages
def setup_directories(self):
for tempest_dir in [self.TEMPEST_ROOT, self.TEMPEST_LOGDIR]:
if not os.path.exists(tempest_dir):

View File

@ -252,6 +252,18 @@ class TestTempestAdminAdapter(test_utils.PatchHelper):
class TestTempestCharm(Helper):
def test_check_tox_installed_trusty(self):
# Test for Bug #1648493
self.patch_object(tempest.host, 'lsb_release')
self.lsb_release.return_value = {'DISTRIB_RELEASE': '14.04'}
self.assertTrue('python-tox' in tempest.TempestCharm().all_packages)
def test_check_tox_installed_xenial(self):
# Test for Bug #1648493
self.patch_object(tempest.host, 'lsb_release')
self.lsb_release.return_value = {'DISTRIB_RELEASE': '16.04'}
self.assertTrue('tox' in tempest.TempestCharm().all_packages)
def test_setup_directories(self):
self.patch_object(tempest.os.path, 'exists')
self.patch_object(tempest.os, 'mkdir')