From 0a67b9886b5f3907177ce4b7d3f85339a24b4da6 Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Wed, 12 Aug 2015 18:39:38 +0530 Subject: [PATCH] Adds option to skip specific tests With this we can specify a class name or a specific test (class.method) to skip. Change-Id: I2effb5c937fbe2b54a34049651b0d5d194550589 --- heat_integrationtests/common/config.py | 10 ++++++---- heat_integrationtests/functional/functional_base.py | 9 ++++++--- .../heat_integrationtests.conf.sample | 9 +++++---- heat_integrationtests/scenario/scenario_base.py | 8 +++++--- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/heat_integrationtests/common/config.py b/heat_integrationtests/common/config.py index c7a324b929..b45a8d8c0f 100644 --- a/heat_integrationtests/common/config.py +++ b/heat_integrationtests/common/config.py @@ -101,11 +101,13 @@ IntegrationTestGroup = [ default=False, help="Skip all functional tests"), cfg.ListOpt('skip_functional_test_list', - help="List of functional test class names to skip " - "ex. AutoscalingGroupTest, CreateStackTest"), + help="List of functional test class or class.method " + "names to skip ex. AutoscalingGroupTest," + "InstanceGroupBasicTest.test_size_updates_work"), cfg.ListOpt('skip_scenario_test_list', - help="List of scenario test class names to skip " - "ex. NeutronLoadBalancerTest,"), + help="List of scenario test class or class.method " + "names to skip ex. NeutronLoadBalancerTest, " + "CeilometerAlarmTest.test_alarm"), cfg.ListOpt('skip_test_stack_action_list', help="List of stack actions in tests to skip " "ex. ABANDON, ADOPT, SUSPEND, RESUME"), diff --git a/heat_integrationtests/functional/functional_base.py b/heat_integrationtests/functional/functional_base.py index 3a342388b3..3dff3e4591 100644 --- a/heat_integrationtests/functional/functional_base.py +++ b/heat_integrationtests/functional/functional_base.py @@ -21,8 +21,11 @@ class FunctionalTestsBase(test.HeatIntegrationTest): self.client = self.orchestration_client def check_skip_test(self): - test_name = self.__class__.__name__ - test_skipped = (self.conf.skip_functional_test_list and - test_name in self.conf.skip_functional_test_list) + test_cls_name = self.__class__.__name__ + test_method_name = '.'.join([test_cls_name, self._testMethodName]) + test_skipped = (self.conf.skip_functional_test_list and ( + test_cls_name in self.conf.skip_functional_test_list or + test_method_name in self.conf.skip_functional_test_list)) + if self.conf.skip_functional_tests or test_skipped: self.skipTest('Test disabled in conf, skipping') diff --git a/heat_integrationtests/heat_integrationtests.conf.sample b/heat_integrationtests/heat_integrationtests.conf.sample index 796de4ecae..e636394061 100644 --- a/heat_integrationtests/heat_integrationtests.conf.sample +++ b/heat_integrationtests/heat_integrationtests.conf.sample @@ -84,12 +84,13 @@ # Skip all functional tests (boolean value) #skip_functional_tests = false -# List of functional test class names to skip ex. AutoscalingGroupTest, -# CreateStackTest (list value) +# List of functional test class or class.method names to skip ex. +# AutoscalingGroupTest,InstanceGroupBasicTest.test_size_updates_work (list +# value) #skip_functional_test_list = -# List of scenario test class names to skip ex. NeutronLoadBalancerTest, (list -# value) +# List of scenario test class or class.method names to skip ex. +# NeutronLoadBalancerTest, CeilometerAlarmTest.test_alarm (list value) #skip_scenario_test_list = # List of stack actions in tests to skip ex. ABANDON, ADOPT, SUSPEND, RESUME diff --git a/heat_integrationtests/scenario/scenario_base.py b/heat_integrationtests/scenario/scenario_base.py index e347e6a848..84e14a9195 100644 --- a/heat_integrationtests/scenario/scenario_base.py +++ b/heat_integrationtests/scenario/scenario_base.py @@ -59,8 +59,10 @@ class ScenarioTestsBase(test.HeatIntegrationTest): return stack_id def check_skip_test(self): - test_name = self.__class__.__name__ - test_skipped = (self.conf.skip_scenario_test_list and - test_name in self.conf.skip_scenario_test_list) + test_cls_name = self.__class__.__name__ + test_method_name = '.'.join([test_cls_name, self._testMethodName]) + test_skipped = (self.conf.skip_scenario_test_list and ( + test_cls_name in self.conf.skip_scenario_test_list or + test_method_name in self.conf.skip_scenario_test_list)) if self.conf.skip_scenario_tests or test_skipped: self.skipTest('Test disabled in conf, skipping')