Best Python code snippet using autotest_python
drone_utility.py
Source: drone_utility.py
...262 """263 if not os.path.exists(destination_path):264 return False265 return os.path.samefile(source_path, destination_path)266 def wait_for_all_async_commands(self):267 for subproc in self._subcommands:268 subproc.fork_waitfor()269 self._subcommands = []270 def _poll_async_commands(self):271 still_running = []272 for subproc in self._subcommands:273 if subproc.poll() is None:274 still_running.append(subproc)275 self._subcommands = still_running276 def _wait_for_some_async_commands(self):277 self._poll_async_commands()278 max_processes = scheduler_config.config.max_transfer_processes279 while len(self._subcommands) >= max_processes:280 time.sleep(1)281 self._poll_async_commands()282 def run_async_command(self, function, args):283 subproc = subcommand.subcommand(function, args)284 self._subcommands.append(subproc)285 subproc.fork_start()286 def _sync_get_file_from(self, hostname, source_path, destination_path):287 self._ensure_directory_exists(os.path.dirname(destination_path))288 host = create_host(hostname)289 host.get_file(source_path, destination_path, delete_dest=True)290 def get_file_from(self, hostname, source_path, destination_path):291 self.run_async_command(self._sync_get_file_from,292 (hostname, source_path, destination_path))293 def sync_send_file_to(self, hostname, source_path, destination_path,294 can_fail):295 host = create_host(hostname)296 try:297 host.run('mkdir -p ' + os.path.dirname(destination_path))298 host.send_file(source_path, destination_path, delete_dest=True)299 except error.AutoservError:300 if not can_fail:301 raise302 if os.path.isdir(source_path):303 failed_file = os.path.join(source_path, _TRANSFER_FAILED_FILE)304 file_object = open(failed_file, 'w')305 try:306 file_object.write('%s:%s\n%s\n%s' %307 (hostname, destination_path,308 datetime.datetime.now(),309 traceback.format_exc()))310 finally:311 file_object.close()312 else:313 copy_to = destination_path + _TRANSFER_FAILED_FILE314 self._ensure_directory_exists(os.path.dirname(copy_to))315 self.copy_file_or_directory(source_path, copy_to)316 def send_file_to(self, hostname, source_path, destination_path,317 can_fail=False):318 self.run_async_command(self.sync_send_file_to,319 (hostname, source_path, destination_path,320 can_fail))321 def _report_long_execution(self, calls, duration):322 call_count = {}323 for call in calls:324 call_count.setdefault(call._method, 0)325 call_count[call._method] += 1326 call_summary = '\n'.join('%d %s' % (count, method)327 for method, count in call_count.iteritems())328 self._warn('Execution took %f sec\n%s' % (duration, call_summary))329 def execute_calls(self, calls):330 results = []331 start_time = time.time()332 max_processes = scheduler_config.config.max_transfer_processes333 for method_call in calls:334 results.append(method_call.execute_on(self))335 if len(self._subcommands) >= max_processes:336 self._wait_for_some_async_commands()337 self.wait_for_all_async_commands()338 duration = time.time() - start_time339 if duration > self._WARNING_DURATION:340 self._report_long_execution(calls, duration)341 warnings = self.warnings342 self.warnings = []343 return dict(results=results, warnings=warnings)344def create_host(hostname):345 username = settings.get_value('SCHEDULER', hostname + '_username',346 default=getpass.getuser())347 return hosts.SSHHost(hostname, user=username)348def parse_input():349 input_chunks = []350 chunk_of_input = sys.stdin.read()351 while chunk_of_input:...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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!!