Best Python code snippet using autotest_python
drone_manager.py
Source:drone_manager.py
...680 else:681 base_dir = os.path.join(drones.AUTOTEST_INSTALL_DIR,682 _DRONE_RESULTS_DIR_SUFFIX)683 return os.path.join(base_dir, path)684 def _copy_results_helper(self, process, source_path, destination_path,685 to_results_repository=False):686 logging.debug('_copy_results_helper. process: %s, source_path: %s, '687 'destination_path: %s, to_results_repository: %s',688 process, source_path, destination_path,689 to_results_repository)690 full_source = self.absolute_path(source_path)691 full_destination = self.absolute_path(692 destination_path, on_results_repository=to_results_repository)693 source_drone = self._get_drone_for_process(process)694 if to_results_repository:695 source_drone.send_file_to(self._results_drone, full_source,696 full_destination, can_fail=True)697 else:698 source_drone.queue_call('copy_file_or_directory', full_source,699 full_destination)700 def copy_to_results_repository(self, process, source_path,701 destination_path=None):702 """703 Copy results from the given process at source_path to destination_path704 in the results repository.705 This will only copy the results back for Special Agent Tasks (Cleanup,706 Verify, Repair) that reside in the hosts/ subdirectory of results if707 the copy_task_results_back flag has been set to True inside708 global_config.ini709 It will also only copy .parse.log files back to the scheduler if the710 copy_parse_log_back flag in global_config.ini has been set to True.711 """712 if not ENABLE_ARCHIVING:713 return714 copy_task_results_back = global_config.global_config.get_config_value(715 scheduler_config.CONFIG_SECTION, 'copy_task_results_back',716 type=bool)717 copy_parse_log_back = global_config.global_config.get_config_value(718 scheduler_config.CONFIG_SECTION, 'copy_parse_log_back',719 type=bool)720 special_task = source_path.startswith(HOSTS_JOB_SUBDIR)721 parse_log = source_path.endswith(PARSE_LOG)722 if (copy_task_results_back or not special_task) and (723 copy_parse_log_back or not parse_log):724 if destination_path is None:725 destination_path = source_path726 self._copy_results_helper(process, source_path, destination_path,727 to_results_repository=True)728 def _copy_to_results_repository(self, process, source_path,729 destination_path=None):730 """731 Copy results from the given process at source_path to destination_path732 in the results repository, without special task handling.733 """734 if destination_path is None:735 destination_path = source_path736 self._copy_results_helper(process, source_path, destination_path,737 to_results_repository=True)738 def copy_results_on_drone(self, process, source_path, destination_path):739 """740 Copy a results directory from one place to another on the drone.741 """742 self._copy_results_helper(process, source_path, destination_path)743 def _write_attached_files(self, results_dir, drone):744 attached_files = self._attached_files.pop(results_dir, {})745 for file_path, contents in attached_files.iteritems():746 drone.queue_call('write_to_file', self.absolute_path(file_path),747 contents)748 def attach_file_to_execution(self, results_dir, file_contents,749 file_path=None):750 """751 When the process for the results directory is executed, the given file752 contents will be placed in a file on the drone. Returns the path at753 which the file will be placed.754 """755 if not file_path:756 file_path = self.get_temporary_path('attach')...
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!!