How to use nuke_myself method in avocado

Best Python code snippet using avocado_python

process.py

Source:process.py Github

copy

Full Screen

...672 (be it exit_code or zombie)673 :param sig: Signal to send to the process in case it did not end after674 the specified timeout.675 """676 def nuke_myself():677 self.result.interrupted = ("timeout after %.9fs"678 % (time.monotonic() - self.start_time))679 try:680 kill_process_tree(self.get_pid(), sig, timeout=1)681 except RuntimeError:682 try:683 kill_process_tree(self.get_pid(), signal.SIGKILL,684 timeout=1)685 LOG.warning("Process '%s' refused to die in 1s after "686 "sending %s to, destroyed it successfully "687 "using SIGKILL.", self.cmd, sig)688 except RuntimeError:689 LOG.error("Process '%s' refused to die in 1s after "690 "sending %s, followed by SIGKILL, probably "691 "dealing with a zombie process.", self.cmd,692 sig)693 self._init_subprocess()694 rc = None695 if timeout is None:696 rc = self._popen.wait()697 elif timeout > 0.0:698 timer = threading.Timer(timeout, nuke_myself)699 try:700 timer.start()701 rc = self._popen.wait()702 finally:703 timer.cancel()704 if rc is None:705 stop_time = time.monotonic() + 1706 while time.monotonic() < stop_time:707 rc = self._popen.poll()708 if rc is not None:709 break710 else:711 nuke_myself()712 rc = self._popen.poll()713 if rc is None:714 # If all this work fails, we're dealing with a zombie process.715 raise AssertionError('Zombie Process %s' % self._popen.pid)716 self._fill_results(rc)717 return rc718 def stop(self, timeout=None):719 """720 Stop background subprocess.721 Call this method to terminate the background subprocess and722 wait for it results.723 :param timeout: Time (seconds) we'll wait until the process is724 finished. If it's not, we'll try to terminate it725 and it's children using ``sig`` and get a...

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