How to use _internal_run method in lisa

Best Python code snippet using lisa_python

sshcontrol.py

Source:sshcontrol.py Github

copy

Full Screen

...84 def log(self, msg):85 if self.logfile:86 with open(self.logfile, "a") as f:87 f.write("%s\n" % msg)88 def _internal_run(self, command, timeout=None, ignore_status = True):89 self.log("[Running]$ %s" % " ".join(command))90 proc = SSHProcess()91 status, output = proc.run(command, timeout, logfile=self.logfile)92 self.log("[Command returned '%d' after %.2f seconds]" % (status, time.time() - proc.starttime))93 if status and not ignore_status:94 raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, status, output))95 return (status, output)96 def run(self, command, timeout=None):97 """98 command - ssh command to run99 timeout=<val> - kill command if there is no output after <val> seconds100 timeout=None - kill command if there is no output after a default value seconds101 timeout=0 - no timeout, let command run until it returns102 """103 # We need to source /etc/profile for a proper PATH on the target104 command = self.ssh + [self.ip, ' . /etc/profile; ' + command]105 if timeout is None:106 return self._internal_run(command, self.defaulttimeout, self.ignore_status)107 if timeout == 0:108 return self._internal_run(command, None, self.ignore_status)109 return self._internal_run(command, timeout, self.ignore_status)110 def copy_to(self, localpath, remotepath):111 command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, remotepath)]112 return self._internal_run(command, ignore_status=False)113 def copy_from(self, remotepath, localpath):114 command = self.scp + ['%s@%s:%s' % (self.user, self.ip, remotepath), localpath]...

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