def make_parser(): """ Takes ArgParse instance with default arguments and adds Positional Arguments: * module_name Flags: * -b (branch) * -l (latest) * -g (git) * -e (epics_version) * -r (rhel_version) Returns: :class:`argparse.ArgumentParser`: ArgParse instance """ parser = ArgParser(usage) parser.add_module_name_arg() parser.add_epics_version_flag() parser.add_git_flag( help_msg="Print releases available in git") parser.add_argument( "-l", "--latest", action="store_true", dest="latest", help="Only print the latest release") parser.add_argument( "-r", "--rhel_version", action="store", type=int, dest="rhel_version", default=get_rhel_version(), help="Change the rhel version of the environment, default is " + get_rhel_version() + " (from your system)") return parser
class AddGitTest(unittest.TestCase): def setUp(self): self.parser = ArgParser("") self.parser.add_git_flag() def test_git_option_has_correct_attributes(self): option = self.parser._option_string_actions['-g'] self.assertIsInstance(option, _StoreTrueAction) self.assertEqual(option.dest, "git") self.assertIn("--git", option.option_strings)
class AddGitTest(unittest.TestCase): def setUp(self): self.parser = ArgParser("") self.parser.add_git_flag() def test_git_option_has_correct_attributes(self): option = self.parser._option_string_actions['-g'] self.assertIsInstance(option, _StoreTrueAction) self.assertEqual(option.dest, "git") self.assertIn("--git", option.option_strings)
def make_parser(): """ Takes ArgParse instance with default arguments and adds Positional Arguments: * module_name Flags: * -b (branch) * -l (latest) * -g (git) * -e (epics_version) * -r (rhel_version) Returns: :class:`argparse.ArgumentParser`: ArgParse instance """ parser = ArgParser(usage) parser.add_module_name_arg() parser.add_epics_version_flag() parser.add_git_flag(help_msg="Print releases available in git") parser.add_argument("-l", "--latest", action="store_true", dest="latest", help="Only print the latest release") parser.add_argument( "-r", "--rhel_version", action="store", type=int, dest="rhel_version", default=get_rhel_version(), help="Change the rhel version of the environment, default is " + get_rhel_version() + " (from your system)") return parser