def run_command(self, command): """convenience helper so we don't forget to include cwd. :param command the command to be executed.""" if not isinstance(command, list): raise ValueError("Expected list for Testrun.run_command, not %s" % str(type(command))) return run_command(command, cwd=self.test_dir)
def run(self, run_args, **kwargs): use_command = run_args \ if isinstance(run_args, list) \ else run_args.split(" ") full_command = self.base_command + use_command # call(*a1, *a2) seems only to work on python 3.5+ return tools.run_command(full_command, **tools.deep_merge(self.run_kwargs, kwargs))
def _run_local_commands(self, commands): """ Executes a list of commands on the local machine (pre- and post- commands, intendedly. :param commands: The commands to execute :return: A list with the return objects. """ if not commands: return rvs = [] for command in _build_exec_array(commands): rvs.append(run_command(command, throw=True, env=dict(os.environ, **self.test_env))) return rvs