def test_text_output(self): output = OutputTool('text') data = self.get_data() OutputLogger.set_build_data('old', data['old']) OutputLogger.set_build_data('new', data['new']) OutputLogger.set_patch_output('Patches:', data['patches']) test_output = {'pkgdiff': ['Following files were moved\n%s' % '\n'.join(data['moved'])]} OutputLogger.set_checker_output('Results from checker(s)', test_output) logfile = os.path.join(self.TESTS_DIR, REBASE_HELPER_RESULTS_LOG) output.print_information(logfile) with open(logfile) as f: lines = [y.strip() for y in f.readlines()] assert lines == self.get_expected_output().split('\n') os.unlink(logfile)
def patch_sources(self, sources): # Patch sources git_helper = GitHelper(sources[0]) git_helper.check_git_config() patch = Patcher(self.conf.patchtool) self.rebase_spec_file.update_changelog(self.rebase_spec_file.get_new_log(git_helper)) try: self.rebased_patches = patch.patch(sources[0], sources[1], self.rest_sources, git_helper, self.spec_file.get_applied_patches(), self.spec_file.get_prep_section(), **self.kwargs) except RuntimeError as run_e: raise RebaseHelperError('Patching failed') self.rebase_spec_file.write_updated_patches(self.rebased_patches) if self.conf.non_interactive: OutputLogger.set_patch_output('Unapplied patches:', self.rebased_patches['unapplied']) OutputLogger.set_patch_output('Patches:', self.rebased_patches)
def setup(self): OutputLogger.set_info_text('Information text', 'some information text') OutputLogger.set_info_text('Next Information', 'some another information text') OutputLogger.set_patch_output('Patches:', self.patches_data) OutputLogger.set_build_data('old', self.old_rpm_data) OutputLogger.set_build_data('new', self.new_rpm_data)