def test_failed_command(self): command = "rsync --foobar" try: snapshotter._run(command.split()) assert False, "We shouldn't get here" except snapshotter.CalledProcessError as err: assert err.command == command assert err.output.startswith("rsync: --foobar: unknown option") assert err.exit_value == 1
def test_debug(self, mock_check_output_function): """_run() should not call check_output() if debug is True.""" snapshotter._run("command", debug=True) assert not mock_check_output_function.called
def test_success_with_stdout(self): output = snapshotter._run("echo foo".split()) assert output == "foo\n"