def test_error_handlers(self): git_failure_message = "Merge conflict during commit: Your file or directory 'WebCore/ChangeLog' is probably out-of-date: resource out of date; try updating at /usr/local/libexec/git-core//git-svn line 469" svn_failure_message = """svn: Commit failed (details follow): svn: File or directory 'ChangeLog' is out of date; try updating svn: resource out of date; try updating """ command_does_not_exist = ['does_not_exist', 'invalid_option'] self.assertRaises(OSError, SCM.run_command, command_does_not_exist) self.assertRaises(OSError, SCM.run_command, command_does_not_exist, error_handler=ignore_error) command_returns_non_zero = ['/bin/sh', '--invalid-option'] self.assertRaises(ScriptError, SCM.run_command, command_returns_non_zero) self.assertTrue( SCM.run_command(command_returns_non_zero, error_handler=ignore_error)) self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=git_failure_message)) self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=svn_failure_message)) self.assertRaises(ScriptError, commit_error_handler, ScriptError(output='blah blah blah'))
def test_error_handlers(self): git_failure_message="Merge conflict during commit: Your file or directory 'WebCore/ChangeLog' is probably out-of-date: resource out of date; try updating at /usr/local/libexec/git-core//git-svn line 469" svn_failure_message="""svn: Commit failed (details follow): svn: File or directory 'ChangeLog' is out of date; try updating svn: resource out of date; try updating """ command_does_not_exist = ['does_not_exist', 'invalid_option'] self.assertRaises(OSError, SCM.run_command, command_does_not_exist) self.assertRaises(OSError, SCM.run_command, command_does_not_exist, error_handler=ignore_error) command_returns_non_zero = ['/bin/sh', '--invalid-option'] self.assertRaises(ScriptError, SCM.run_command, command_returns_non_zero) self.assertTrue(SCM.run_command(command_returns_non_zero, error_handler=ignore_error)) self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=git_failure_message)) self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=svn_failure_message)) self.assertRaises(ScriptError, commit_error_handler, ScriptError(output='blah blah blah'))
def run(args, cwd=None): return SCM.run_command(args, cwd=cwd)
def run(args): SCM.run_command(args)