Cope with diffstat not being present in test_patch.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 15 Apr 2010 17:51:21 +0000 (19:51 +0200)
committerDave Borowitz <dborowitz@google.com>
Fri, 16 Apr 2010 18:56:53 +0000 (11:56 -0700)
dulwich/tests/test_patch.py

index 63c6b940b76db06f76a5a129cabb5a8c774f2bc0..19e42db18a30c216f544b16537fec19c5722cfe7 100644 (file)
@@ -51,8 +51,11 @@ class WriteCommitPatchTests(TestCase):
             "And this is the second line.\n",
             "\n",
             "\n",
-            "---\n",
-            " 0 files changed\n",
+            "---\n"], lines[3:8])
+        self.assertEquals([
             "\n",
             "CONTENTS-- \n",
-            "custom\n"], lines[3:])
+            "custom\n"], lines[-3:])
+        if len(lines) >= 12:
+            # diffstat may not be present
+            self.assertEquals(lines[8], " 0 files changed\n")