瀏覽代碼

Check for specific warning rather than matching entire list. Should fix the build on python 3.4.

Jelmer Vernooij 8 年之前
父節點
當前提交
26833d20cc
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. 10 3
      dulwich/tests/test_repository.py

+ 10 - 3
dulwich/tests/test_repository.py

@@ -528,9 +528,16 @@ exit 1
             author=b'Test Author <test@nodomain.com>',
             commit_timestamp=12345, commit_timezone=0,
             author_timestamp=12345, author_timezone=0)
-        self.assertEqual(len(warnings_list), 1, warnings_list)
-        self.assertIsInstance(warnings_list[-1], UserWarning)
-        self.assertTrue("post-commit hook failed: " in str(warnings_list[-1]))
+        expected_warning = UserWarning(
+            'post-commit hook failed: Hook post-commit exited with '
+            'non-zero status',)
+        for w in warnings_list:
+            if (type(w) == type(expected_warning) and
+                    w.args == expected_warning.args):
+                break
+        else:
+            raise AssertionError('Expected warning %r not in %r' %
+                    (expected_warning, warnings_list))
         self.assertEqual([commit_sha], r[commit_sha2].parents)
 
     def test_as_dict(self):