Преглед на файлове

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

Jelmer Vernooij преди 13 години
родител
ревизия
5eaa77eeff
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  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