diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-07-12 10:48:17 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-07-12 16:12:56 +0200 |
commit | 3030d25d2a25347b0b6c7fcdd14bfe31fc5a86b6 (patch) | |
tree | 045a0cfc89ddc1b9888d05286d2a92eeecf043d0 /xtesting/tests | |
parent | a507f38dc69019523ff02006622eb4ab84cd5ba1 (diff) |
Skip testcases by any env var0.51
It also removes CI_LOOP which is releng centric.
It can be passed as dependency if required.
Change-Id: I146bb97950cb88062451158b7cc6a16c7f9d47a2
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/tests')
-rw-r--r-- | xtesting/tests/unit/ci/test_run_tests.py | 9 | ||||
-rw-r--r-- | xtesting/tests/unit/ci/test_tier_builder.py | 9 | ||||
-rw-r--r-- | xtesting/tests/unit/ci/test_tier_handler.py | 53 |
3 files changed, 6 insertions, 65 deletions
diff --git a/xtesting/tests/unit/ci/test_run_tests.py b/xtesting/tests/unit/ci/test_run_tests.py index de2af66d..448b6f3f 100644 --- a/xtesting/tests/unit/ci/test_run_tests.py +++ b/xtesting/tests/unit/ci/test_run_tests.py @@ -153,6 +153,7 @@ class RunTestsTesting(unittest.TestCase): return_value=test_run_dict): self.runner.clean_flag = True self.runner.run_test(mock_test) + args[0].assert_called_with('test_name') args[1].assert_called_with('test_module') self.assertEqual(self.runner.overall_result, @@ -178,16 +179,8 @@ class RunTestsTesting(unittest.TestCase): def test_run_all_default(self, *mock_methods): os.environ['CI_LOOP'] = 'test_ci_loop' self.runner.run_all() - mock_methods[1].assert_not_called() self.assertTrue(mock_methods[2].called) - @mock.patch('xtesting.ci.run_tests.LOGGER.info') - @mock.patch('xtesting.ci.run_tests.Runner.summary') - def test_run_all_missing_tier(self, *mock_methods): - os.environ['CI_LOOP'] = 'loop_re_not_available' - self.runner.run_all() - self.assertTrue(mock_methods[1].called) - @mock.patch('xtesting.ci.run_tests.Runner.source_envfile', side_effect=Exception) @mock.patch('xtesting.ci.run_tests.Runner.summary') diff --git a/xtesting/tests/unit/ci/test_tier_builder.py b/xtesting/tests/unit/ci/test_tier_builder.py index 402fc664..88018472 100644 --- a/xtesting/tests/unit/ci/test_tier_builder.py +++ b/xtesting/tests/unit/ci/test_tier_builder.py @@ -19,21 +19,19 @@ from xtesting.ci import tier_builder class TierBuilderTesting(unittest.TestCase): def setUp(self): - self.dependency = { - 'installer': 'test_installer', 'scenario': 'test_scenario'} self.testcase = { - 'dependencies': self.dependency, 'enabled': True, + 'enabled': True, 'case_name': 'test_name', 'criteria': 'test_criteria', 'blocking': 'test_blocking', 'description': 'test_desc', 'project_name': 'project_name'} self.testcase_disabled = { - 'dependencies': self.dependency, 'enabled': False, + 'enabled': False, 'case_name': 'test_name_disabled', 'criteria': 'test_criteria', 'blocking': 'test_blocking', 'description': 'test_desc', 'project_name': 'project_name'} self.dic_tier = { 'name': 'test_tier', 'order': 'test_order', - 'ci_loop': 'test_ci_loop', 'description': 'test_desc', + 'description': 'test_desc', 'testcases': [self.testcase, self.testcase_disabled]} self.mock_yaml = mock.Mock() attrs = {'get.return_value': [self.dic_tier]} @@ -96,7 +94,6 @@ class TierBuilderTesting(unittest.TestCase): message = str(self.tierbuilder) self.assertTrue('test_tier' in message) self.assertTrue('test_order' in message) - self.assertTrue('test_ci_loop' in message) self.assertTrue('test_desc' in message) self.assertTrue('test_name' in message) diff --git a/xtesting/tests/unit/ci/test_tier_handler.py b/xtesting/tests/unit/ci/test_tier_handler.py index 97ba5ab3..21670dd9 100644 --- a/xtesting/tests/unit/ci/test_tier_handler.py +++ b/xtesting/tests/unit/ci/test_tier_handler.py @@ -22,19 +22,12 @@ class TierHandlerTesting(unittest.TestCase): self.test = mock.Mock() attrs = {'get_name.return_value': 'test_name'} self.test.configure_mock(**attrs) - self.mock_depend = mock.Mock() - attrs = {'get_scenario.return_value': 'test_scenario', - 'get_installer.return_value': 'test_installer'} - self.mock_depend.configure_mock(**attrs) self.tier = tier_handler.Tier( - 'test_tier', 'test_order', 'test_ci_loop', description='test_desc') + 'test_tier', 'test_order', 'test_desc') self.testcase = tier_handler.TestCase( - 'test_name', 'true', self.mock_depend, 'test_criteria', + 'test_name', 'true', 'test_criteria', True, description='test_desc', project='project_name') - self.dependency = tier_handler.Dependency( - 'test_installer', 'test_scenario') self.testcase.str = self.testcase.__str__() - self.dependency.str = self.dependency.__str__() self.tier.str = self.tier.__str__() def test_split_text(self): @@ -77,39 +70,6 @@ class TierHandlerTesting(unittest.TestCase): def test_get_order(self): self.assertEqual(self.tier.get_order(), 'test_order') - def test_get_ci_loop(self): - self.assertEqual(self.tier.get_ci_loop(), 'test_ci_loop') - - def test_testcase_is_compatible(self): - self.assertEqual( - self.testcase.is_compatible('test_installer', 'test_scenario'), - True) - - def test_testcase_is_compatible_2(self): - self.assertEqual( - self.testcase.is_compatible('missing_installer', 'test_scenario'), - False) - self.assertEqual( - self.testcase.is_compatible('test_installer', 'missing_scenario'), - False) - - @mock.patch('re.search', side_effect=TypeError) - def test_testcase_is_compatible3(self, *args): - self.assertEqual( - self.testcase.is_compatible('test_installer', 'test_scenario'), - False) - args[0].assert_called_once_with('test_installer', 'test_installer') - - def test_testcase_is_compatible_4(self): - self.assertEqual( - self.testcase.is_compatible(None, 'test_scenario'), False) - self.assertEqual( - self.testcase.is_compatible('', 'test_scenario'), False) - self.assertEqual( - self.testcase.is_compatible('test_installer', None), False) - self.assertEqual( - self.testcase.is_compatible('test_installer', ''), False) - def test_testcase_get_name(self): self.assertEqual(self.tier.get_name(), 'test_tier') @@ -128,15 +88,6 @@ class TierHandlerTesting(unittest.TestCase): def test_testcase_get_order(self): self.assertEqual(self.tier.get_order(), 'test_order') - def test_testcase_get_ci_loop(self): - self.assertEqual(self.tier.get_ci_loop(), 'test_ci_loop') - - def test_dependency_get_installer(self): - self.assertEqual(self.dependency.get_installer(), 'test_installer') - - def test_dependency_get_scenario(self): - self.assertEqual(self.dependency.get_scenario(), 'test_scenario') - if __name__ == "__main__": logging.disable(logging.CRITICAL) |