How to use _dump_code_information method in lisa

Best Python code snippet using lisa_python

main.py

Source:main.py Github

copy

Full Screen

...32 path = _runtime_root / path33 else:34 path = _runtime_root / path_type35 return path36def _dump_code_information(log: Logger) -> None:37 command = r'git log -1 "--pretty=format:%H%d %ci, %s"'38 output = subprocess.getoutput(command)39 log.info(f"git head: {output}")40 output = subprocess.getoutput(f"git submodule foreach --recursive {command}")41 if output:42 log.info(f"submodules: {output}")43@retry(FileExistsError, tries=10, delay=0.2)44def test_path(45 log_root_path: Path, working_root_path: Path, run_id: str = ""46) -> PurePath:47 if run_id:48 # use predefined run_id49 logic_path = PurePath(run_id)50 else:51 # Get current time and generate a Run ID.52 current_time = datetime.utcnow()53 date_of_today = current_time.strftime("%Y%m%d")54 time_of_today = get_datetime_path(current_time)55 logic_path = PurePath(f"{date_of_today}/{time_of_today}")56 log_path = log_root_path / logic_path57 if log_path.exists():58 raise FileExistsError(59 f"The log path '{log_path}' already exists, "60 f"and not found an unique path."61 )62 working_path = working_root_path / logic_path63 if working_path.exists():64 raise FileExistsError(65 f"The working path '{working_path}' already exists, "66 f"and not found an unique path."67 )68 log_path.mkdir(parents=True)69 return logic_path70def initialize_runtime_folder(71 log_path: Optional[Path] = None,72 working_path: Optional[Path] = None,73 run_id: str = "",74) -> None:75 global _runtime_root76 cache_path = _runtime_root.joinpath("cache")77 cache_path.mkdir(parents=True, exist_ok=True)78 constants.CACHE_PATH = cache_path79 # Layout the run time folder structure.80 log_path = _normalize_path("log", log_path)81 working_path = _normalize_path("working", working_path)82 logic_path = test_path(log_path, working_path, run_id=run_id)83 constants.RUN_ID = logic_path.name84 constants.RUN_LOGIC_PATH = logic_path85 constants.RUN_LOCAL_LOG_PATH = log_path / logic_path86 constants.RUN_LOCAL_WORKING_PATH = working_path / logic_path87def main() -> int:88 total_timer = create_timer()89 log = get_logger()90 exit_code: int = 091 file_handler: Optional[FileHandler] = None92 try:93 args = parse_args()94 initialize_runtime_folder(args.log_path, args.working_path, args.run_id)95 log_level = DEBUG if (args.debug) else INFO96 set_level(log_level)97 file_handler = create_file_handler(98 Path(f"{constants.RUN_LOCAL_LOG_PATH}/lisa-{constants.RUN_ID}.log")99 )100 log.info(f"Python version: {sys.version}")101 log.info(f"local time: {datetime.now().astimezone()}")102 _dump_code_information(log)103 # We don't want command line args logging to leak any provided104 # secrets, if any ("s:key:value" syntax)105 add_secrets_from_pairs(args.variables)106 log.debug(f"command line args: {sys.argv}")107 log.info(108 f"run log path: {constants.RUN_LOCAL_LOG_PATH}, "109 f"working path: {constants.RUN_LOCAL_WORKING_PATH}"110 )111 exit_code = args.func(args)112 assert isinstance(exit_code, int), f"actual: {type(exit_code)}"113 finally:114 log.info(f"completed in {total_timer}")115 if file_handler:116 remove_handler(log_handler=file_handler, logger=log)...

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