How to use support_runbook method in lisa

Best Python code snippet using lisa_python

argparser.py

Source:argparser.py Github

copy

Full Screen

...3from argparse import ArgumentParser, Namespace4from pathlib import Path5from lisa import commands6from lisa.util import constants7def support_runbook(parser: ArgumentParser, required: bool = True) -> None:8 parser.add_argument(9 "--runbook",10 "-r",11 type=Path,12 required=required,13 help="Specify the path of runbook. "14 "It can be an absolute path or a relative path.",15 default=Path("examples/runbook/hello_world.yml").absolute(),16 )17def support_debug(parser: ArgumentParser) -> None:18 parser.add_argument(19 "--debug",20 "-d",21 dest="debug",22 action="store_true",23 help="Set the log level output by the console to DEBUG level. By default, the "24 "console displays logs with INFO and higher levels. The log file will contain "25 "the DEBUG level and is not affected by this setting.",26 )27def support_variable(parser: ArgumentParser) -> None:28 parser.add_argument(29 "--variable",30 "-v",31 dest="variables",32 action="append",33 help="Variables are defined in runbooks, LISA doesn't pre-define any variable, "34 "Specify one or more variables in the format of `name:value`, which will "35 "overwrite the value in the YAML file. It can support secret values in the "36 "format of `s:name:value`. Learn more from documents.",37 )38def support_log_path(parser: ArgumentParser) -> None:39 parser.add_argument(40 "--log_path",41 "-l",42 type=Path,43 dest="log_path",44 help="Uses to replace the default log root path.",45 )46def support_working_path(parser: ArgumentParser) -> None:47 parser.add_argument(48 "--working_path",49 "-w",50 type=Path,51 dest="working_path",52 help="Uses to replace the default log working path.",53 )54def support_id(parser: ArgumentParser) -> None:55 parser.add_argument(56 "--id",57 "-i",58 type=Path,59 dest="run_id",60 help="The ID is used to avoid conflicts on names or folders. If the log or "61 "name has a chance to conflict in a global storage, use an unique ID to avoid "62 "it.",63 )64def parse_args() -> Namespace:65 """This wraps Python's 'ArgumentParser' to setup our CLI."""66 parser = ArgumentParser(prog="lisa")67 support_debug(parser)68 support_runbook(parser, required=False)69 support_variable(parser)70 support_log_path(parser)71 support_working_path(parser)72 support_id(parser)73 # Default to ‘run’ when no subcommand is given.74 parser.set_defaults(func=commands.run)75 subparsers = parser.add_subparsers(dest="cmd", required=False)76 # Entry point for ‘run’.77 run_parser = subparsers.add_parser("run")78 run_parser.set_defaults(func=commands.run)79 # Entry point for ‘list-start’.80 list_parser = subparsers.add_parser(constants.LIST)81 list_parser.set_defaults(func=commands.list_start)82 list_parser.add_argument(83 "--type",84 "-t",85 dest="type",86 choices=["case"],87 help="specify the information type",88 )89 list_parser.add_argument(90 "--all",91 "-a",92 dest="list_all",93 action="store_true",94 help="ignore test case selection, and display all test cases",95 )96 # Entry point for ‘check’.97 check_parser = subparsers.add_parser("check")98 check_parser.set_defaults(func=commands.check)99 for sub_parser in subparsers.choices.values():100 support_runbook(sub_parser)101 support_variable(sub_parser)102 support_debug(sub_parser)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful