def test_ok_with_callback(): msg = [''] def callback(m): msg[0] = m run_cmd('echo hola', stdout_callback=callback) assert msg[0] == 'hola\n'
def run_helper(cmd, env=None): try: logging.debug('Running cmd: {}'.format(cmd)) return run_cmd(cmd, env=env, stdout_callback=None, stderr_callback=None) except CmdException: raise
def test_ok(): run_cmd('ls')
def test_fail(): with pytest.raises(CmdException): run_cmd('dfasdfad')