MCPcopy Index your code
hub / github.com/StackStorm/st2 / assertProcessIsRunning

Method assertProcessIsRunning

st2tests/st2tests/base.py:626–652  ·  view source on GitHub ↗

Assert that a long running process provided Process object as returned by subprocess.Popen has succesfuly started and is running.

(self, process)

Source from the content-addressed store, hash-verified

624 del self.processes[process.pid]
625
626 def assertProcessIsRunning(self, process):
627 """
628 Assert that a long running process provided Process object as returned by subprocess.Popen
629 has succesfuly started and is running.
630 """
631 if not process:
632 raise ValueError("process is None")
633
634 return_code = process.poll()
635
636 if return_code is not None:
637 if process.stdout:
638 stdout = process.stdout.read()
639 else:
640 stdout = ""
641
642 if process.stderr:
643 stderr = process.stderr.read()
644 else:
645 stderr = ""
646
647 msg = "Process exited with code=%s.\nStdout:\n%s\n\nStderr:\n%s" % (
648 return_code,
649 stdout,
650 stderr,
651 )
652 self.fail(msg)
653
654 def assertProcessExited(self, proc):
655 try:

Calls 2

pollMethod · 0.45
readMethod · 0.45