How to use _retrieve_source_job_config method in avocado

Best Python code snippet using avocado_python

replay.py

Source:replay.py Github

copy

Full Screen

...40 def _exit_fail(message):41 output.LOG_UI.error(message)42 sys.exit(exit_codes.AVOCADO_FAIL)43 @staticmethod44 def _retrieve_source_job_config(source_job_id):45 results_dir = get_job_results_dir(source_job_id)46 if not results_dir:47 msg = 'Could not find the results directory for Job "%s"' % source_job_id48 Replay._exit_fail(msg)49 config_file_path = os.path.join(results_dir, 'jobdata', 'args.json')50 try:51 with open(config_file_path, 'r') as config_file:52 return json.load(config_file)53 except OSError:54 msg = 'Could not open the source Job configuration "%s"' % config_file_path55 Replay._exit_fail(msg)56 except json.decoder.JSONDecodeError:57 msg = 'Could not read a valid configuration from file "%s"' % config_file_path58 Replay._exit_fail(msg)59 def run(self, config):60 namespace = 'job.replay.source_job_id'61 source_job_id = config.get(namespace)62 source_job_config = self._retrieve_source_job_config(source_job_id)63 if hasattr(source_job_config, namespace):64 del(source_job_config[namespace])65 # Flag that this is indeed a replayed job, which is impossible to66 # tell solely based on the job.replay.source_job_id given that it67 # has a default value of 'latest' for convenience reasons68 source_job_config['job.replay.enabled'] = True69 with job.Job.from_config(source_job_config) as job_instance:70 pre_post_dispatcher = JobPrePostDispatcher()71 try:72 output.log_plugin_failures(pre_post_dispatcher.load_failures)73 pre_post_dispatcher.map_method('pre', job_instance)74 job_run = job_instance.run()75 finally:76 pre_post_dispatcher.map_method('post', job_instance)...

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