From 99fba2e10066e27915c72fc30ed67722355fa275 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Tue, 30 Jun 2009 10:50:33 +0200 Subject: [PATCH] Make it easier to compare and debug error testcase failures --- runtests.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/runtests.py b/runtests.py index a0b7c0d7..9a16ad36 100644 --- a/runtests.py +++ b/runtests.py @@ -318,14 +318,22 @@ class CythonCompileTestCase(unittest.TestCase): sys.stderr = old_stderr if errors or expected_errors: - for expected, error in zip(expected_errors, errors): - self.assertEquals(expected, error) - if len(errors) < len(expected_errors): - expected_error = expected_errors[len(errors)] - self.assertEquals(expected_error, None) - elif len(errors) > len(expected_errors): - unexpected_error = errors[len(expected_errors)] - self.assertEquals(None, unexpected_error) + try: + for expected, error in zip(expected_errors, errors): + self.assertEquals(expected, error) + if len(errors) < len(expected_errors): + expected_error = expected_errors[len(errors)] + self.assertEquals(expected_error, None) + elif len(errors) > len(expected_errors): + unexpected_error = errors[len(expected_errors)] + self.assertEquals(None, unexpected_error) + except AssertionError: + print("\n=== Expected errors: ===") + print('\n'.join(expected_errors)) + print "\n\n=== Got errors: ===" + print('\n'.join(errors)) + print('\n') + raise else: if not self.cython_only: self.run_distutils(module, workdir, incdir) -- 2.26.2