示例#1
0
    def test_text_output_tool(self):
        output = OutputTool('text')
        output.print_information(self.results_file_path, self.results_store)

        with open(self.results_file_path) as f:
            lines = [y.strip() for y in f.readlines()]
            assert lines == self.get_expected_text_output().split('\n')
示例#2
0
    def test_text_output_tool(self):
        output = OutputTool('text')
        output.print_information(self.results_file_path, self.results_store)

        with open(self.results_file_path) as f:
            lines = [y.strip() for y in f.readlines()]
            assert lines == self.get_expected_text_output().split('\n')
示例#3
0
    def test_json_output_tool(self):
        output = OutputTool('json')
        output.print_information(self.results_file_path, self.results_store)

        with open(self.results_file_path) as f:
            json_dict = json.load(f, encoding='utf-8')
            # in Python2 strings in json decoded dict are Unicode, which would make the test fail
            assert json_dict == json.loads(json.dumps(self.get_expected_json_output()))
示例#4
0
    def test_json_output_tool(self):
        output = OutputTool('json')
        output.print_information(self.results_file_path, self.results_store)

        with open(self.results_file_path) as f:
            json_dict = json.load(f, encoding='utf-8')
            # in Python2 strings in json decoded dict are Unicode, which would make the test fail
            assert json_dict == json.loads(
                json.dumps(self.get_expected_json_output()))
    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_checker_output('Following files were moved', '\n'.join(data['moved']))

        logfile = os.path.join(self.TESTS_DIR, REBASE_HELPER_RESULTS_LOG)
        output.print_information(logfile)

        with open(logfile) as f:
            assert f.read().strip() == self.get_expected_output()

        os.unlink(logfile)
示例#6
0
    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)
示例#7
0
 def build_parser():
     parser = CustomArgumentParser(description=PROGRAM_DESCRIPTION,
                                   formatter_class=CustomHelpFormatter)
     parser.add_argument("-v",
                         "--verbose",
                         default=False,
                         action="store_true",
                         help="be more verbose (recommended)")
     parser.add_argument("-p",
                         "--patch-only",
                         default=False,
                         action="store_true",
                         help="only apply patches")
     parser.add_argument("-b",
                         "--build-only",
                         default=False,
                         action="store_true",
                         help="only build SRPM and RPMs")
     parser.add_argument("--buildtool",
                         choices=Builder.get_supported_tools(),
                         default=Builder.get_default_tool(),
                         help="build tool to use, defaults to %(default)s")
     parser.add_argument(
         "--pkgcomparetool",
         choices=checkers_runner.get_supported_tools(),
         default=checkers_runner.get_default_tools(),
         type=lambda s: s.split(','),
         help=
         "set of tools to use for package comparison, defaults to %(default)s"
     )
     parser.add_argument(
         "--outputtool",
         choices=OutputTool.get_supported_tools(),
         default=OutputTool.get_default_tool(),
         help=
         "tool to use for formatting rebase output, defaults to %(default)s"
     )
     parser.add_argument(
         "-w",
         "--keep-workspace",
         default=False,
         action="store_true",
         help="do not remove workspace directory after finishing")
     parser.add_argument("--not-download-sources",
                         default=False,
                         action="store_true",
                         help="do not download sources")
     parser.add_argument("-c",
                         "--continue",
                         default=False,
                         action="store_true",
                         dest='cont',
                         help="continue previously interrupted rebase")
     parser.add_argument("sources",
                         metavar='SOURCES',
                         help="new upstream sources")
     parser.add_argument("--non-interactive",
                         default=False,
                         action="store_true",
                         dest='non_interactive',
                         help="do not interact with user")
     parser.add_argument(
         "--comparepkgs-only",
         default=False,
         dest="comparepkgs",
         metavar="COMPAREPKGS_DIR",
         help=
         "compare already built packages, %(metavar)s must be a directory "
         "with the following structure: <dir_name>/{old,new}/RPM")
     parser.add_argument(
         "--builds-nowait",
         default=False,
         action="store_true",
         help="do not wait for koji or copr builds to finish")
     # deprecated argument, kept for backward compatibility
     parser.add_argument("--fedpkg-build-tasks",
                         dest="fedpkg_build_tasks",
                         type=lambda s: s.split(','),
                         help=argparse.SUPPRESS)
     parser.add_argument("--build-tasks",
                         dest="build_tasks",
                         metavar="OLD_TASK,NEW_TASK",
                         type=lambda s: s.split(','),
                         help="comma-separated koji or copr task ids")
     parser.add_argument(
         "--results-dir",
         help="directory where rebase-helper output will be stored")
     parser.add_argument(
         "--build-retries",
         default=2,
         help="number of retries of a failed build, defaults to %(default)d",
         type=int)
     parser.add_argument(
         "--builder-options",
         default=None,
         metavar="BUILDER_OPTIONS",
         help=
         "enable arbitrary local builder option(s), enclose %(metavar)s in quotes "
         "and note that = before it is mandatory")
     return parser
示例#8
0
 def build_parser():
     parser = CustomArgumentParser(description=PROGRAM_DESCRIPTION, formatter_class=CustomHelpFormatter)
     parser.add_argument("-v", "--verbose", default=False, action="store_true", help="be more verbose (recommended)")
     parser.add_argument("-p", "--patch-only", default=False, action="store_true", help="only apply patches")
     parser.add_argument("-b", "--build-only", default=False, action="store_true", help="only build SRPM and RPMs")
     parser.add_argument(
         "--buildtool",
         choices=Builder.get_supported_tools(),
         default=Builder.get_default_tool(),
         help="build tool to use, defaults to %(default)s",
     )
     parser.add_argument(
         "--pkgcomparetool",
         choices=checkers_runner.get_supported_tools(),
         default=checkers_runner.get_default_tools(),
         type=lambda s: s.split(","),
         help="set of tools to use for package comparison, defaults to %(default)s",
     )
     parser.add_argument(
         "--outputtool",
         choices=OutputTool.get_supported_tools(),
         default=OutputTool.get_default_tool(),
         help="tool to use for formatting rebase output, defaults to %(default)s",
     )
     parser.add_argument(
         "-w",
         "--keep-workspace",
         default=False,
         action="store_true",
         help="do not remove workspace directory after finishing",
     )
     parser.add_argument(
         "--not-download-sources", default=False, action="store_true", help="do not download sources"
     )
     parser.add_argument(
         "-c",
         "--continue",
         default=False,
         action="store_true",
         dest="cont",
         help="continue previously interrupted rebase",
     )
     parser.add_argument("sources", metavar="SOURCES", help="new upstream sources")
     parser.add_argument(
         "--non-interactive",
         default=False,
         action="store_true",
         dest="non_interactive",
         help="do not interact with user",
     )
     parser.add_argument(
         "--comparepkgs-only",
         default=False,
         dest="comparepkgs",
         metavar="COMPAREPKGS_DIR",
         help="compare already built packages, %(metavar)s must be a directory "
         "with the following structure: <dir_name>/{old,new}/RPM",
     )
     parser.add_argument(
         "--builds-nowait", default=False, action="store_true", help="do not wait for koji or copr builds to finish"
     )
     # deprecated argument, kept for backward compatibility
     parser.add_argument(
         "--fedpkg-build-tasks", dest="fedpkg_build_tasks", type=lambda s: s.split(","), help=argparse.SUPPRESS
     )
     parser.add_argument(
         "--build-tasks",
         dest="build_tasks",
         metavar="OLD_TASK,NEW_TASK",
         type=lambda s: s.split(","),
         help="comma-separated koji or copr task ids",
     )
     parser.add_argument("--results-dir", help="directory where rebase-helper output will be stored")
     parser.add_argument(
         "--build-retries", default=2, help="number of retries of a failed build, defaults to %(default)d", type=int
     )
     parser.add_argument(
         "--builder-options",
         default=None,
         metavar="BUILDER_OPTIONS",
         help="enable arbitrary local builder option(s), enclose %(metavar)s in quotes "
         "and note that = before it is mandatory",
     )
     return parser