From b5dda3ce0570dbc888d77bfff9b13321eb33608c Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Fri, 8 Feb 2019 23:38:38 +0100 Subject: [PATCH] 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 --- .../backend/agent/api_server/test_keepalivedlvs.py | 8 ++++---- tox.ini | 4 ++++ zuul.d/projects.yaml | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py b/octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py index ee2650b606..58e808a965 100644 --- a/octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py +++ b/octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py @@ -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') diff --git a/tox.ini b/tox.ini index 9df1e1d6c1..bde7082220 100644 --- a/tox.ini +++ b/tox.ini @@ -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} diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 7ec2c7eee1..b4e42ee239 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -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