def test_verbose_log(self): conf = { self.VERBOSE_KEY: False, self.STEPS_LOG_KEY: False, self.FLOWS_LOG_KEY: False, } conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertFalse(conf_obj.get(self.VERBOSE_KEY)) conf[self.STEPS_LOG_KEY] = True conf[self.FLOWS_LOG_KEY] = False conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertTrue(conf_obj.get(self.VERBOSE_KEY)) conf[self.STEPS_LOG_KEY] = False conf[self.FLOWS_LOG_KEY] = True conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertTrue(conf_obj.get(self.VERBOSE_KEY)) conf[self.STEPS_LOG_KEY] = True conf[self.FLOWS_LOG_KEY] = True conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertTrue(conf_obj.get(self.VERBOSE_KEY))
def test_multiprocessing_async(self): conf = { self.MULTIPROCESSING_KEY: False, self.GEVENT_KEY: False, self.THREADING_KEY: False, self.ASYNC_SUITES_KEY: False, self.ASYNC_TESTS_KEY: False, } conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertFalse(conf_obj.get(self.MULTIPROCESSING_KEY)) conf[self.ASYNC_SUITES_KEY] = True conf[self.ASYNC_TESTS_KEY] = False conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertTrue(conf_obj.get(self.MULTIPROCESSING_KEY)) conf[self.ASYNC_SUITES_KEY] = False conf[self.ASYNC_TESTS_KEY] = True conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertTrue(conf_obj.get(self.MULTIPROCESSING_KEY)) conf[self.ASYNC_SUITES_KEY] = True conf[self.ASYNC_TESTS_KEY] = True conf_obj = config_factory.create(**conf) config.prepare_config(conf_obj) self.assertTrue(conf_obj.get(self.MULTIPROCESSING_KEY))
def test_get_shuffle_return_values(self): fake_config = config_factory.create(**{ 'RANDOM': True, 'RANDOM_SEED': 1, }) return_value = collector.get_shuffle(fake_config) self.assertIsInstance(return_value, types.MethodType)
def test_logging_settings_list(self, mock_dictConfig): conf_logging_not_dict = { self.LOGGING_KEY: [1, 2, 3], } conf = config_factory.create(**conf_logging_not_dict) config.prepare_config(conf) mock_dictConfig.assert_not_called()
def test_logging_settings_dict(self, mock_dictConfig): conf_logging_dict = { self.LOGGING_KEY: { 'mock': True, } } conf = config_factory.create(**conf_logging_dict) config.prepare_config(conf) mock_dictConfig.assert_called_with(conf_logging_dict.get(self.LOGGING_KEY))
def test_create_generator_no_tests_param( self, base_generator, get_test_name_from_command, get_case_name_from_command, get_suite_name_from_command, get_shuffle): fake_config = config_factory.create() return_value = collector.create_generator([], fake_config) self.assertEqual(return_value, 'base_generator') base_generator.assert_called_once() get_test_name_from_command.assert_not_called() get_case_name_from_command.assert_not_called() get_suite_name_from_command.assert_not_called() get_shuffle.assert_called_once()
def test_create_generator( self, generator_by_commands, get_test_name_from_command, get_case_name_from_command, get_suite_name_from_command, get_shuffle): fake_config = config_factory.create(**{'TESTS': ['one:two.three']}) return_value = collector.create_generator([], fake_config) self.assertEqual(return_value, 'generator_by_comms') generator_by_commands.assert_called_once() get_test_name_from_command.assert_called_once() get_case_name_from_command.assert_called_once() get_suite_name_from_command.assert_called_once() get_shuffle.assert_called_once()
def test_get_shuffle_no_params(self): fake_config = config_factory.create() return_value = collector.get_shuffle(fake_config) self.assertIsNone(return_value)