def test_setup_parser(mock_plugin_mgr, mock_driver_mgr, config): parser = cli.setup_parser(config) subparsers = next(x._name_parser_map for x in parser._actions if hasattr(x, '_name_parser_map')) assert len(subparsers) == 6 assert 'test' in subparsers process_opts = subparsers['postprocess']._option_string_actions assert "--an-integer" in process_opts assert process_opts["--an-integer"].dest == 'test_process2.an_integer' assert process_opts["--an-integer"].type == int assert "--no-a-boolean" in process_opts assert process_opts["--no-a-boolean"].help == 'Disable a boolean' assert "--float" in process_opts assert process_opts["--float"].type == float output_opts = subparsers['output']._option_string_actions assert "--selectable" in output_opts assert output_opts["--selectable"].choices == ['a', 'b', 'c']
def test_setup_parser(config): parser = cli.setup_parser(config) subparsers = next(x._name_parser_map for x in parser._actions if hasattr(x, '_name_parser_map')) assert len(subparsers) == 6 assert 'test' in subparsers process_opts = subparsers['postprocess']._option_string_actions assert "--an-integer" in process_opts assert process_opts["--an-integer"].dest == 'test_process2.an_integer' assert process_opts["--an-integer"].type == int assert "--no-a-boolean" in process_opts assert process_opts["--no-a-boolean"].help == 'Disable a boolean' assert "--float" in process_opts assert process_opts["--float"].type == float output_opts = subparsers['output']._option_string_actions assert "--selectable" in output_opts assert output_opts["--selectable"].choices == ['a', 'b', 'c']
def test_parser(self): cli.get_pluginmanager = Mock() # TODO: Test if plugin arguments are added parser = cli.setup_parser()