class_docstr: Integration tests for horovod.runner.
class_docstr_tok: ["Integration","tests","for","horovod.runner","."]
code: def do_test_run_with_controller_success(self, controller, mode, run):
      if run == "func":
          command = None
          run_func = fn
      elif run == "cmd":
          command = "true"
          run_func = None
      else:
          self.fail("unknown run argument {}".format(run))
  
      with self.horovod_args(
          mode, controller, run_func=run_func, command=command
      ) as (hargs, exec):
          if controller == "mpi" and run == "cmd":
              self.assertIsNone(_run(hargs))
              exec.assert_called_once()
              args, kwargs = exec.call_args
              executable, args, env = args
              self.assertEqual("/bin/sh", executable)
              self.assertEqual(3, len(args))
              self.assertEqual("/bin/sh", args[0])
              self.assertEqual("-c", args[1])
              exit_code = safe_shell_exec.execute(args[2], env)
              self.assertEqual(0, exit_code)
          else:
              actual = _run(hargs)
              expected = (
                  list(
                      [
                          (rank, hargs.num_proc)
                          for rank in range(hargs.num_proc)
                      ]
                  )
                  if run == "func"
                  else None
              )
              self.assertEqual(expected, actual)
  
imports: import contextlib
  import io
  import itertools
  import os
  import sys
  import warnings
  import mock
  from parameterized import parameterized
  import pytest
  import unittest
  from horovod.common.util import gloo_built, mpi_built
  from horovod.runner.common.util import safe_shell_exec
  from horovod.runner import _HorovodArgs
  from horovod.runner.launch import _check_all_hosts_ssh_successful, _run
  from horovod.runner.mpi_run import mpi_available
  from common import capture
label_desc: Use image node_id 5 for calling the StaticRunTests obj's underlying member method code with example usage: obj.do_test_run_with_controller_success(controller, mode, run) without return types