From c4a60129cd1bddf46f89e3dce23e10ae0e4e014f Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Wed, 24 Nov 2010 15:58:27 +0000 Subject: [PATCH] display specified msg too. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40605 20353a03-c40f-0410-a6d1-a30d3c3de9de --- buildout/tests/assertSoftware.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/buildout/tests/assertSoftware.py b/buildout/tests/assertSoftware.py index 4aa01cba7a..62e5a6896d 100644 --- a/buildout/tests/assertSoftware.py +++ b/buildout/tests/assertSoftware.py @@ -139,20 +139,22 @@ class AssertSoftwareMixin(unittest.TestCase): try: return unittest.TestCase.assertEqual(self, first, second, msg=msg) except unittest.TestCase.failureException: - if (msg is None) and \ - isinstance(first, list) and \ + if isinstance(first, list) and \ isinstance(second, list): - msg = '' + err = '' for elt in first: if elt not in second: - msg += '- %s\n' % elt + err += '- %s\n' % elt for elt in second: if elt not in first: - msg += '+ %s\n' % elt - if msg == '': + err += '+ %s\n' % elt + if err == '': raise else: - msg = 'Lists are different:\n%s' % msg + if msg: + msg = '%s: Lists are different:\n%s' % (msg, err) + else: + msg = 'Lists are different:\n%s' % err raise unittest.TestCase.failureException, msg else: raise -- 2.30.9