From a814961796061804d9e5390e70fd0610a53a2aa9 Mon Sep 17 00:00:00 2001 From: Benny Kopilov Date: Thu, 17 Mar 2022 11:47:41 +0200 Subject: [PATCH] Fix compute_unified decoration Current test class decorate the class with skip. The problem is that when feature is disabled the skip section returns a function type. The ServersQuotaTest class inherits from a function type instead type (class) and it fails with TypeError: function() argument We dont see the exception because on false we dont try to run testtool version is 2.5.0 Change-Id: I3ff2e59ca1eaae4f9b1eb1fb7148cd3efcbcd8f2 --- tempest/scenario/test_compute_unified_limits.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tempest/scenario/test_compute_unified_limits.py b/tempest/scenario/test_compute_unified_limits.py index bacf526ef9..eda6d6fb8c 100644 --- a/tempest/scenario/test_compute_unified_limits.py +++ b/tempest/scenario/test_compute_unified_limits.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import testtools - from tempest.common import utils from tempest.common import waiters from tempest import config @@ -25,8 +23,6 @@ from tempest.scenario import manager CONF = config.CONF -@testtools.skipUnless(CONF.compute_feature_enabled.unified_limits, - 'Compute unified limits are not enabled') class ComputeProjectQuotaTest(manager.ScenarioTest): """The test base class for compute unified limits tests. @@ -40,6 +36,12 @@ class ComputeProjectQuotaTest(manager.ScenarioTest): credentials = ['primary', 'system_admin'] force_tenant_isolation = True + @classmethod + def skip_checks(cls): + super(ComputeProjectQuotaTest, cls).skip_checks() + if not CONF.compute_feature_enabled.unified_limits: + raise cls.skipException('Compute unified limits are not enabled.') + @classmethod def resource_setup(cls): super(ComputeProjectQuotaTest, cls).resource_setup() @@ -67,8 +69,6 @@ class ComputeProjectQuotaTest(manager.ScenarioTest): self.limit_ids[name], value) -@testtools.skipUnless(CONF.compute_feature_enabled.unified_limits, - 'Compute unified limits are not enabled') class ServersQuotaTest(ComputeProjectQuotaTest): @classmethod