How to use _make_scp_cmd method in autotest

Best Python code snippet using autotest_python

ssh_flavor.py

Source:ssh_flavor.py Github

copy

Full Screen

...60 def create_clean_device_dir(self, path):61 """Like shutil.rmtree() + os.makedirs(), but on a remote device."""62 self._remove_device_dir(path)63 self._create_device_dir(path)64 def _make_scp_cmd(self, remote_path, recurse=True):65 """Prepare an SCP command.66 Returns a partial SCP command and an adjusted remote path.67 """68 cmd = ['scp']69 if recurse:70 cmd.append('-r')71 if self.port:72 cmd.extend(['-P', self.port])73 adj_remote_path = self.host + ':' + remote_path74 if self.user:75 adj_remote_path = self.user + '@' + adj_remote_path76 return cmd, adj_remote_path77 def copy_directory_contents_to_device(self, host_dir, device_dir):78 """Like shutil.copytree(), but for copying to a remote device."""79 _, remote_path = self._make_scp_cmd(device_dir)80 cmd = [os.path.join(self._bot_info.skia_dir, 'tools',81 'scp_dir_contents.sh'),82 host_dir, remote_path]83 self._bot_info.run(cmd)84 def copy_directory_contents_to_host(self, device_dir, host_dir):85 """Like shutil.copytree(), but for copying from a remote device."""86 _, remote_path = self._make_scp_cmd(device_dir)87 cmd = [os.path.join(self._bot_info.skia_dir, 'tools',88 'scp_dir_contents.sh'),89 remote_path, host_dir]90 self._bot_info.run(cmd)91 def copy_file_to_device(self, host_path, device_path):92 """Like shutil.copyfile, but for copying to a connected device."""93 cmd, remote_path = self._make_scp_cmd(device_path, recurse=False)94 cmd.extend([host_path, remote_path])95 self._bot_info.run(cmd)96 def read_file_on_device(self, path):97 return self.ssh(['cat', path]).rstrip()98 def remove_file_on_device(self, path):99 """Delete the given file."""...

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 autotest 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