Best Python code snippet using avocado_python
test.py
Source:test.py
...263 def _tag_end(self):264 self.running = False265 self.time_end = time.time()266 # for consistency sake, always use the same stupid method267 self._update_time_elapsed(self.time_end)268 def _update_time_elapsed(self, current_time=None):269 if current_time is None:270 current_time = time.time()271 self.time_elapsed = current_time - self.time_start272 def report_state(self):273 """274 Send the current test state to the test runner process275 """276 if self.runner_queue is not None:277 self.runner_queue.put(self.get_state())278 def get_state(self):279 """280 Serialize selected attributes representing the test state281 :returns: a dictionary containing relevant test state data282 :rtype: dict283 """284 if self.running and self.time_start:285 self._update_time_elapsed()286 preserve_attr = ['basedir', 'debugdir', 'depsdir', 'fail_reason',287 'logdir', 'logfile', 'name', 'resultsdir', 'srcdir',288 'status', 'sysinfodir', 'text_output', 'time_elapsed',289 'traceback', 'workdir', 'whiteboard', 'time_start',290 'time_end', 'running', 'paused', 'paused_msg',291 'fail_class', 'params', "timeout"]292 state = dict([(key, self.__dict__.get(key)) for key in preserve_attr])293 state['class_name'] = self.__class__.__name__294 state['job_logdir'] = self.job.logdir295 state['job_unique_id'] = self.job.unique_id296 return state297 def _register_log_file_handler(self, logger, formatter, filename,298 log_level=logging.DEBUG):299 file_handler = logging.FileHandler(filename=filename)...
downloader.py
Source:downloader.py
...115 self.dl_count = 0116 self.time_elapsed = 0117 self.dl_rate = None118 self.start_time = datetime.now()119 def _update_time_elapsed(self):120 diff = datetime.now() - self.start_time121 self.time_elapsed = diff.total_seconds()122 def current_download_rate(self):123 self.dl_rate = self.dl_count / (self.time_elapsed * 3600)124 return self.dl_rate125 def increment_dl_count(self):126 self.dl_count += 1127 self._update_time_elapsed()128# bd_440 = BuildingData(client, 440)129# bd_440.get_all_point_data()130# bd_426 = BuildingData(client, 426)131# bd_440.get_all_point_data()132sample_buildings = [426, 440, 112, 217, 100, 154, 373, 442, 134, 316]133interesting_buildings = [134 441,135 110,136 127,137 120,138 477,139 141,140 230,141 423,...
project_check_btn.py
Source:project_check_btn.py
...46 tools_gw.open_dialog(self.dlg_audit_project, dlg_name='project_check')47 def _calculate_elapsed_time(self, dialog):48 tf = time() # Final time49 td = tf - self.t0 # Delta time50 self._update_time_elapsed(f"Exec. time: {timedelta(seconds=round(td))}", dialog)51 def _update_time_elapsed(self, text, dialog):52 if isdeleted(dialog):53 self.timer.stop()54 return55 lbl_time = dialog.findChild(QLabel, 'lbl_time')56 lbl_time.setText(text)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!