From 4eb280c930e797b9f5e27f032c2df9643647dc31 Mon Sep 17 00:00:00 2001 From: "ChangBo Guo(gcb)" Date: Wed, 31 May 2017 15:15:19 +0800 Subject: [PATCH] Remove usage of parameter enforce_type Oslo.config deprecated parameter enforce_type and change its default value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0. Remove the usage of it to avoid DeprecationWarning: "Using the 'enforce_type' argument is deprecated in version '4.0' and will be removed in version '5.0': The argument enforce_type has changed its default value to True and then will be removed completely." Related--Bug: #1517839 Change-Id: I643e23f358e6a71f5361daa9cc2ef5ebdd44c792 --- .../plugins/openstack/context/sahara/test_sahara_cluster.py | 3 +-- tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py | 6 ++---- tests/unit/plugins/openstack/scenarios/sahara/test_utils.py | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py b/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py index b06187ce..711577fa 100644 --- a/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py +++ b/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py @@ -46,8 +46,7 @@ class SaharaClusterTestCase(test.ScenarioTestCase): "tenant_id": str(i), "credential": mock.MagicMock()}) - CONF.set_override("sahara_cluster_check_interval", 0, "benchmark", - enforce_type=True) + CONF.set_override("sahara_cluster_check_interval", 0, "benchmark") self.context.update({ "config": { diff --git a/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py b/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py index 3012d910..1ae8e308 100644 --- a/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py +++ b/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py @@ -30,10 +30,8 @@ class SaharaJobTestCase(test.ScenarioTestCase): super(SaharaJobTestCase, self).setUp() self.context = test.get_test_context() - CONF.set_override("sahara_cluster_check_interval", 0, "benchmark", - enforce_type=True) - CONF.set_override("sahara_job_check_interval", 0, "benchmark", - enforce_type=True) + CONF.set_override("sahara_cluster_check_interval", 0, "benchmark") + CONF.set_override("sahara_job_check_interval", 0, "benchmark") @mock.patch("%s.CreateLaunchJob._run_job_execution" % BASE) def test_create_launch_job_java(self, mock_run_job): diff --git a/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py b/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py index 23f3ee6d..75b512ce 100644 --- a/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py @@ -41,10 +41,8 @@ class SaharaScenarioTestCase(test.ScenarioTestCase): def setUp(self): super(SaharaScenarioTestCase, self).setUp() - CONF.set_override("sahara_cluster_check_interval", 0, "benchmark", - enforce_type=True) - CONF.set_override("sahara_job_check_interval", 0, "benchmark", - enforce_type=True) + CONF.set_override("sahara_cluster_check_interval", 0, "benchmark") + CONF.set_override("sahara_job_check_interval", 0, "benchmark") def test_list_node_group_templates(self): ngts = []