How to use __start_job_logging method in avocado

Best Python code snippet using avocado_python Github


Full Screen

...98 self.result = result.Result(self)99 self.sysinfo = None100 self.timeout = getattr(self.args, 'job_timeout', 0)101 self.__logging_handlers = {}102 self.__start_job_logging()103 self.funcatexit = data_structures.CallbackRegister("JobExit %s"104 % self.unique_id,105 _TEST_LOGGER)106 self._stdout_stderr = None107 self.replay_sourcejob = getattr(self.args, 'replay_sourcejob', None)108 self.exitcode = exit_codes.AVOCADO_ALL_OK109 #: The list of discovered/resolved tests that will be attempted to110 #: be run by this job. If set to None, it means that test resolution111 #: has not been attempted. If set to an empty list, it means that no112 #: test was found during resolution.113 self.test_suite = None114 # A job may not have a dispatcher for pre/post tests execution plugins115 self._job_pre_post_dispatcher = None116 # The result events dispatcher is shared with the test runner.117 # Because of our goal to support using the phases of a job118 # freely, let's get the result events dispatcher ready early.119 # A future optimization may load it on demand.120 self._result_events_dispatcher = dispatcher.ResultEventsDispatcher(self.args)121 output.log_plugin_failures(self._result_events_dispatcher.load_failures)122 def _setup_job_results(self):123 """124 Prepares a job result directory, also known as logdir, for this job125 """126 logdir = getattr(self.args, 'logdir', None)127 if self.standalone:128 if logdir is not None:129 logdir = os.path.abspath(logdir)130 self.logdir = data_dir.create_job_logs_dir(logdir=logdir,131 unique_id=self.unique_id)132 else:133 self.logdir = tempfile.mkdtemp(prefix='avocado_' + __name__)134 else:135 if logdir is None:136 self.logdir = data_dir.create_job_logs_dir(unique_id=self.unique_id)137 else:138 logdir = os.path.abspath(logdir)139 self.logdir = data_dir.create_job_logs_dir(logdir=logdir,140 unique_id=self.unique_id)141 if not (self.standalone or getattr(self.args, "dry_run", False)):142 self._update_latest_link()143 self.logfile = os.path.join(self.logdir, "job.log")144 idfile = os.path.join(self.logdir, "id")145 with open(idfile, 'w') as id_file_obj:146 id_file_obj.write("%s\n" % self.unique_id)147 def __start_job_logging(self):148 # Enable test logger149 fmt = ('%(asctime)s %(module)-16.16s L%(lineno)-.4d %('150 'levelname)-5.5s| %(message)s')151 test_handler = output.add_log_handler("avocado.test",152 logging.FileHandler,153 self.logfile, self.loglevel, fmt)154 root_logger = logging.getLogger()155 root_logger.addHandler(test_handler)156 root_logger.setLevel(self.loglevel)157 self.__logging_handlers[test_handler] = ["avocado.test", ""]158 # Add --store-logging-streams159 fmt = '%(asctime)s %(levelname)-5.5s| %(message)s'160 formatter = logging.Formatter(fmt=fmt, datefmt='%H:%M:%S')161 for name in getattr(self.args, "store_logging_stream", []):...

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:


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?