From 4a061029eddee38110e416e3c4f60d553dafc9e5 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Thu, 29 May 2008 02:14:25 -0700 Subject: [PATCH] tests: add a test for git.foo( with_exceptions=True ) This test ensures that a GitCommandError is raised when git returns a non-zero exit status. Signed-off-by: David Aguilar --- test/git/test_git.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/git/test_git.py b/test/git/test_git.py index 63343d9..4706694 100644 --- a/test/git/test_git.py +++ b/test/git/test_git.py @@ -1,6 +1,7 @@ import os from test.testlib import * -from git_python import * +from git_python import Git +from git_python import errors class TestGit(object): def setup(self): @@ -35,3 +36,11 @@ class TestGit(object): def test_it_returns_status_and_ignores_stderr(self): assert_equal( (1, ""), self.git.this_does_not_exist(with_status=True) ) + + def test_it_raises_errors(self): + error_raised = False + try: + self.git.this_does_not_exist(with_exceptions=True) + except errors.GitCommandError, e: + error_raised = True + assert_equal( True, error_raised ) -- 2.34.1