How to use handle_show_command method in avocado

Best Python code snippet using avocado_python

jobs.py

Source:jobs.py Github

copy

Full Screen

...170 return self._download_tests(results_data.get('tests'),171 destination,172 job_id,173 spawner)174 def handle_show_command(self, config):175 """Called when 'avocado jobs show' command is executed."""176 job_id = config.get('jobs.show.job_id')177 results_dir = get_job_results_dir(job_id)178 if results_dir is None:179 LOG_UI.error("Error: Job %s not found", job_id)180 return exit_codes.AVOCADO_GENERIC_CRASH181 results_file = os.path.join(results_dir, 'results.json')182 config_file = os.path.join(results_dir, 'jobdata/args.json')183 try:184 results_data = self._get_data_from_file(results_file)185 except FileNotFoundError as ex:186 # Results data are important and should exit if not found187 LOG_UI.error(ex)188 return exit_codes.AVOCADO_GENERIC_CRASH189 try:190 config_data = self._get_data_from_file(config_file)191 except FileNotFoundError:192 pass193 data = {'JOB ID': job_id,194 'JOB LOG': results_data.get('debuglog'),195 'SPAWNER': config_data.get('nrunner.spawner', 'unknown')}196 # We could improve this soon with more data and colors197 self._print_job_details(data)198 LOG_UI.info("")199 self._print_job_tests(results_data.get('tests'))200 results = ('PASS %d | ERROR %d | FAIL %d | SKIP %d |'201 'WARN %d | INTERRUPT %s | CANCEL %s')202 results %= (results_data.get('pass', 0),203 results_data.get('error', 0),204 results_data.get('failures', 0),205 results_data.get('skip', 0),206 results_data.get('warn', 0),207 results_data.get('interrupt', 0),208 results_data.get('cancel', 0))209 self._print_job_details({'RESULTS': results})210 return exit_codes.AVOCADO_ALL_OK211 def run(self, config):212 results = {}213 jobs_dir = get_logs_dir()214 for result in glob(os.path.join(jobs_dir, '*/results.json')):215 with open(result, 'r') as fp:216 job = json.load(fp)217 results[job['job_id']] = result218 subcommand = config.get('jobs_subcommand')219 if subcommand == 'list':220 return self.handle_list_command(results)221 elif subcommand == 'show':222 return self.handle_show_command(config)223 elif subcommand == 'get-output-files':224 return self.handle_output_files_command(config)...

Full Screen

Full Screen

cli.py

Source:cli.py Github

copy

Full Screen

...222 _COLOR_FOR_STATUS[info.status or git.ProjectStatus.UNDEFINED],223 )224 for info in projects_info225 )226def handle_show_command(227 args: argparse.Namespace,228 user_config: config_module.UserConfig,229) -> None:230 """Process show command."""231 workon_dir = git.WorkingDir(args.directory)232 projects_info = workon_dir.show(check_status=not args.nocheck)233 logging.info(_build_projects_info_text(projects_info))234# pylint:enable=unused-argument235FUNC_FOR_COMMAND = {236 "start": handle_start_command,237 "done": handle_done_command,238 "config": handle_config_command,239 "show": handle_show_command,240}...

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 avocado 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