Browse Source

tests/compat: Explicitly raise AssertionError if 'git' returns non-zero; assert can be optimized away.

Jelmer Vernooij 13 years ago
parent
commit
5eaa77eeff
1 changed files with 3 additions and 2 deletions
  1. 3 2
      dulwich/tests/compat/utils.py

+ 3 - 2
dulwich/tests/compat/utils.py

@@ -133,8 +133,9 @@ def run_git_or_fail(args, git_path=_DEFAULT_GIT, input=None, **popen_kwargs):
     popen_kwargs['stderr'] = subprocess.STDOUT
     returncode, stdout = run_git(args, git_path=git_path, input=input,
                                  capture_stdout=True, **popen_kwargs)
-    assert returncode == 0, "git with args %r failed with %d" % (
-        args, returncode)
+    if returncode != 0:
+        raise AssertionError("git with args %r failed with %d" % (
+            args, returncode))
     return stdout