Best Python code snippet using tempest_python
net_downtime.py
Source:net_downtime.py
...23 # Note: for intervals lower than 0.2 ping requires root privileges24 self.interval = interval25 self.ping_process = None26 def _setUp(self):27 self.start_background_pinger()28 def start_background_pinger(self):29 cmd = ['ping', '-q', '-s1']30 cmd.append('-i{}'.format(self.interval))31 cmd.append(self.dest_ip)32 LOG.debug("Starting background pinger to '{}' with interval {}".format(33 self.dest_ip, self.interval))34 self.ping_process = subprocess.Popen(35 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)36 self.addCleanup(self.cleanup)37 def cleanup(self):38 if self.ping_process and self.ping_process.poll() is None:39 LOG.debug('Terminating background pinger with pid {}'.format(40 self.ping_process.pid))41 self.ping_process.terminate()42 self.ping_process = None...
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!!