def setUp(self): self._listener = MagicMock(ExecutorListener) self._tested = Component(name="Foo", test_settings=TestSettings( "green tests", "junit", "./", ".xml")) self._log = BytesIO() self._engine = Engine(self._tested, SimulatedShell(self._log, "."), self._listener) self._configurations = [("config_1", "useless"), ("config_2", "useless")]
def execute(self, arguments): self._ui.welcome() self._prepare_directories(arguments) try: model = self._load_model() testing = model.tests configurations = self._load_configurations(model) selected_configurations = self._filter(arguments, list(configurations)) with open("camp_execute.log", "wb") as log_file: shell = self._select_shell(arguments, log_file) engine = Engine(testing, shell, arguments, self._ui) reports = engine.execute(selected_configurations) self._output.save_reports(reports) self._ui.summarize_execution(reports) except InvalidYAMLModel as error: self._ui.invalid_yaml_model(error) except InvalidModel as error: self._ui.invalid_model(error) except MissingModel as error: self._ui.missing_model(error) except NoConfigurationFound as error: self._ui.no_configuration_found(error) except ShellCommandFailed as error: self._ui.shell_command_failed(error) except ServiceNotReady as error: self._ui.service_not_ready(error) except ReportFormatNotSupported as error: self._ui.report_format_not_supported(error) except Exception as error: stack_trace = extract_tb(exc_info()[2]) self._ui.unexpected_error(error, stack_trace) finally: self._ui.goodbye()