Fix functional tests under Python >= 3.6

Newer Python versions don't like passing a mock in to an os.path.join:

  TypeError: join() argument must be str or bytes, not 'MagicMock'

This patch also adds openstack-tox-functional-py36 to the gate queue.
Recent and major LTS distributions ship Python 3.6 or greater.

Change-Id: Ic71059da24e0d2c3f0ac3af5375906d8e8aa43f4
This commit is contained in:
Carlos Goncalves 2019-02-08 23:38:38 +01:00
parent ddcae3e229
commit b5dda3ce05
3 changed files with 22 additions and 4 deletions

View File

@ -381,7 +381,7 @@ class KeepalivedLvsTestCase(base.TestCase):
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
'get_os_init_system', return_value=consts.INIT_SYSTEMD)
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
'get_keepalivedlvs_pid')
'get_keepalivedlvs_pid', return_value="12345")
@mock.patch('subprocess.check_output')
@mock.patch('os.remove')
@mock.patch('os.path.exists')
@ -416,7 +416,7 @@ class KeepalivedLvsTestCase(base.TestCase):
m_webob.Response.assert_has_calls(calls)
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
'get_keepalivedlvs_pid')
'get_keepalivedlvs_pid', return_value="12345")
@mock.patch('subprocess.check_output')
@mock.patch('os.path.exists')
def test_delete_udp_listener_stop_service_fail(self, m_exist,
@ -432,7 +432,7 @@ class KeepalivedLvsTestCase(base.TestCase):
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
'get_os_init_system', return_value=consts.INIT_SYSVINIT)
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
'get_keepalivedlvs_pid')
'get_keepalivedlvs_pid', return_value="12345")
@mock.patch('subprocess.check_output')
@mock.patch('os.remove')
@mock.patch('os.path.exists')
@ -453,7 +453,7 @@ class KeepalivedLvsTestCase(base.TestCase):
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
'get_os_init_system')
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
'get_keepalivedlvs_pid')
'get_keepalivedlvs_pid', return_value="12345")
@mock.patch('subprocess.check_output')
@mock.patch('os.remove')
@mock.patch('os.path.exists')

View File

@ -53,6 +53,10 @@ setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
basepython = python3.5
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py36]
basepython = python3.6
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:debug]
basepython = python3
commands = oslo_debug_helper {posargs}

View File

@ -33,6 +33,13 @@
- ^doc/.*$
- ^etc/.*$
- ^releasenotes/.*$
- openstack-tox-functional-py36:
irrelevant-files:
- ^.*\.rst$
- ^api-ref/.*$
- ^doc/.*$
- ^etc/.*$
- ^releasenotes/.*$
- octavia-v1-dsvm-scenario
- octavia-v1-dsvm-py3x-scenario
- octavia-v2-dsvm-noop-api
@ -83,6 +90,13 @@
- ^doc/.*$
- ^etc/.*$
- ^releasenotes/.*$
- openstack-tox-functional-py36:
irrelevant-files:
- ^.*\.rst$
- ^api-ref/.*$
- ^doc/.*$
- ^etc/.*$
- ^releasenotes/.*$
- octavia-v1-dsvm-scenario
- octavia-v1-dsvm-py3x-scenario
- neutron-lbaasv2-dsvm-api