Ejemplo n.º 1
0
                ", ".join(mod_names)))

        print("Loading Commands...")
        # setup CLI
        az_cli = DummyCli()
        create_invoker_and_load_cmds_and_args(az_cli)

        print("Loading all old help...")
        all_cli_help = get_all_help(az_cli)
        old_loaded_help = {data.command: data for data in all_cli_help}

        print("Now writing out new help.yaml file contents...")
        for file, help_dict in file_to_help.items():
            logger.warning("Writing {} ...".format(file))
            with open(file, "w") as f:
                yaml.safe_dump(help_dict, f)

        print("Loading all help again...")
        all_cli_help = get_all_help(az_cli)
        new_loaded_help = {data.command: data for data in all_cli_help}

        assert len(old_loaded_help) == len(new_loaded_help)

        diff_dict = {}
        for command in old_loaded_help:
            diff_dict[command] = (old_loaded_help[command],
                                  new_loaded_help[command])

        logger.warning("Loaded {} help objects".format(len(new_loaded_help)))
        logger.warning(
            "Verifying that help objects are the same for _help.py and help.yaml."
Ejemplo n.º 2
0
            exit("No help.yaml file generated for {}.".format(", ".join(mod_names)))

        print("Loading Commands...")
        # setup CLI
        az_cli = DummyCli()
        create_invoker_and_load_cmds_and_args(az_cli)

        print("Loading all old help...")
        all_cli_help = get_all_help(az_cli)
        old_loaded_help = {data.command: data for data in all_cli_help}

        print("Now writing out new help.yaml file contents...")
        for file, help_dict in file_to_help.items():
            logger.warning("Writing {} ...".format(file))
            with open(file, "w") as f:
                yaml.safe_dump(help_dict, f)

        print("Loading all help again...")
        all_cli_help = get_all_help(az_cli)
        new_loaded_help = {data.command: data for data in all_cli_help}

        assert len(old_loaded_help) == len(new_loaded_help)

        diff_dict = {}
        for command in old_loaded_help:
            diff_dict[command] = (old_loaded_help[command], new_loaded_help[command])

        logger.warning("Loaded {} help objects".format(len(new_loaded_help)))
        logger.warning("Verifying that help objects are the same for _help.py and help.yaml.")
        assert len(diff_dict) == len(loaded_helps)
        for old, new in diff_dict.values():