X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Ftests%2Funit%2Fopenstack%2Ftempest%2Ftest_tempest.py;h=b8b258b3607f24945980981c030ad0f69b632584;hb=ac816628995c1e017f12ba23435ae07d24ceecac;hp=e05e5dfac640ff6d89502425b9112d4b75131bee;hpb=35473374d1eba4814b8344d094e62210ef17d9b1;p=functest.git diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py index e05e5dfac..b8b258b36 100644 --- a/functest/tests/unit/openstack/tempest/test_tempest.py +++ b/functest/tests/unit/openstack/tempest/test_tempest.py @@ -18,8 +18,6 @@ from functest.utils.constants import CONST class OSTempestTesting(unittest.TestCase): - logging.disable(logging.CRITICAL) - def setUp(self): with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'conf_utils.get_verifier_id', @@ -114,8 +112,8 @@ class OSTempestTesting(unittest.TestCase): mock.patch.object(self.tempestcommon, 'read_file', return_value=['test1', 'test2']): conf_utils.TEMPEST_BLACKLIST = Exception - CONST.INSTALLER_TYPE = 'installer_type' - CONST.DEPLOY_SCENARIO = 'deploy_scenario' + CONST.__setattr__('INSTALLER_TYPE', 'installer_type') + CONST.__setattr__('DEPLOY_SCENARIO', 'deploy_scenario') self.tempestcommon.apply_tempest_blacklist() obj = m() obj.write.assert_any_call('test1\n') @@ -130,8 +128,8 @@ class OSTempestTesting(unittest.TestCase): return_value=['test1', 'test2']), \ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'yaml.safe_load', return_value=item_dict): - CONST.INSTALLER_TYPE = 'installer_type' - CONST.DEPLOY_SCENARIO = 'deploy_scenario' + CONST.__setattr__('INSTALLER_TYPE', 'installer_type') + CONST.__setattr__('DEPLOY_SCENARIO', 'deploy_scenario') self.tempestcommon.apply_tempest_blacklist() obj = m() obj.write.assert_any_call('test1\n') @@ -151,24 +149,6 @@ class OSTempestTesting(unittest.TestCase): assert_any_call("Starting Tempest test suite: '%s'." % cmd_line) - @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.logger.info') - def test_parse_verifier_result_default(self, mock_logger_info): - self.tempestcommon.VERIFICATION_ID = 'test_uuid' - self.tempestcommon.case_name = 'test_case_name' - stdout = ['Testscount||2', 'Success||2', 'Skipped||0', 'Failures||0'] - with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' - 'subprocess.Popen') as mock_popen, \ - mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' - 'ft_utils.check_success_rate') as mock_method, \ - mock.patch('__builtin__.open', mock.mock_open()): - mock_stdout = mock.Mock() - attrs = {'stdout': stdout} - mock_stdout.configure_mock(**attrs) - mock_popen.return_value = mock_stdout - - self.tempestcommon.parse_verifier_result() - mock_method.assert_any_call('test_case_name', 100) - @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'os.path.exists', return_value=False) @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs', @@ -248,4 +228,5 @@ class OSTempestTesting(unittest.TestCase): if __name__ == "__main__": + logging.disable(logging.CRITICAL) unittest.main(verbosity=2)