Update tox.ini for py27 requirement

Reactive source charms are Python3-only, but have py27 unit tests
declared in project-config.

The Tox tool recently changed behavior.  It used to pass when a tox
target was missing commands.  Now it fails in that case.

This commit places a py27 no-op shim to allow gate tests to pass,
effectively restoring the original behavior for these py3x-only repos.

Fix unit tests after underlying changes in charms.openstack which
set_config_defined_certs_and_keys and added oncigure_source to
the default install method.

Change-Id: I82445240c49a2d58c6eb39da4f49d21350d8d8b4
Partial-Bug: 1642981
This commit is contained in:
Ryan Beisner 2016-11-28 18:20:43 -06:00 committed by Liam Young
parent 7d4d259117
commit 91d8d10382
3 changed files with 9 additions and 19 deletions

View File

@ -114,14 +114,6 @@ class AodhCharm(charms_openstack.charm.HAOpenStackCharm):
release = ch_utils.os_release('python-keystonemiddleware')
super(AodhCharm, self).__init__(release=release, **kwargs)
def install(self):
"""Customise the installation, configure the source and then call the
parent install() method to install the packages
"""
self.configure_source()
# and do the actual install
super(AodhCharm, self).install()
def install():
"""Use the singleton from the AodhCharm to install the packages on the

10
tox.ini
View File

@ -24,6 +24,14 @@ basepython = python2.7
commands =
charm-build --log-level DEBUG -o {toxinidir}/build src {posargs}
[testenv:py27]
basepython = python2.7
# Reactive source charms are Python3-only, but a py27 unit test target
# is required by OpenStack Governance. Remove this shim as soon as
# permitted. http://governance.openstack.org/reference/cti/python_cti.html
whitelist_externals = true
commands = true
[testenv:py34]
basepython = python3.4
deps = -r{toxinidir}/test-requirements.txt
@ -35,7 +43,7 @@ deps = -r{toxinidir}/test-requirements.txt
commands = ostestr {posargs}
[testenv:pep8]
basepython = python2.7
basepython = python3.5
deps = -r{toxinidir}/test-requirements.txt
commands = flake8 {posargs} src unit_tests

View File

@ -47,15 +47,11 @@ class Helper(unittest.TestCase):
class TestOpenStackAodh(Helper):
def test_install(self):
self.patch(aodh.AodhCharm,
'set_config_defined_certs_and_keys')
self.patch(aodh.AodhCharm.singleton, 'install')
aodh.install()
self.install.assert_called_once_with()
def test_setup_endpoint(self):
self.patch(aodh.AodhCharm,
'set_config_defined_certs_and_keys')
self.patch(aodh.AodhCharm, 'service_name',
new_callable=mock.PropertyMock)
self.patch(aodh.AodhCharm, 'region',
@ -77,8 +73,6 @@ class TestOpenStackAodh(Helper):
'type1', 'region1', 'public_url', 'internal_url', 'admin_url')
def test_render_configs(self):
self.patch(aodh.AodhCharm,
'set_config_defined_certs_and_keys')
self.patch(aodh.AodhCharm.singleton, 'render_with_interfaces')
aodh.render_configs('interfaces-list')
self.render_with_interfaces.assert_called_once_with(
@ -123,15 +117,11 @@ class TestAodhAdapters(Helper):
class TestAodhCharm(Helper):
def test__init__(self):
self.patch(aodh.AodhCharm,
'set_config_defined_certs_and_keys')
self.patch(aodh.ch_utils, 'os_release')
aodh.AodhCharm()
self.os_release.assert_called_once_with('python-keystonemiddleware')
def test_install(self):
self.patch(aodh.AodhCharm,
'set_config_defined_certs_and_keys')
b = aodh.AodhCharm()
self.patch(aodh.charms_openstack.charm.OpenStackCharm,
'configure_source')