[Python-modules-commits] [python-pyld] 173/276: Fix verbose output.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:48:07 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-pyld.

commit 9c7ecab998cfa6280edab50895fd2e893455aa8c
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Mon Sep 9 23:12:16 2013 -0400

    Fix verbose output.
---
 tests/runtests.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/tests/runtests.py b/tests/runtests.py
index 6a57a13..251dd63 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -158,20 +158,28 @@ class Test(unittest.TestCase):
         fn = test_info['fn']
         params = test_info['params']
         params = [param(self) for param in params]
+        result = None
+        if self.is_positive:
+            expect = read_test_property('expect')(self)
+        else:
+            expect = data['expect']
 
         try:
             result = apply(getattr(jsonld, fn), params)
             if self.is_negative:
                 raise AssertionError('Expected an error; one was not raised')
-            expect = read_test_property('expect')(self)
             self.assertEqual(result, expect)
         except Exception as e:
             if not self.is_negative:
-                print('\nEXPECTED: ', json.dumps(expect, indent=2))
-                print('ACTUAL: ', json.dumps(result, indent=2))
+                if not isinstance(e, AssertionError):
+                    print('\n')
+                    traceback.print_exc(file=sys.stdout)
+                else:
+                    print('\nEXPECTED: ', json.dumps(expect, indent=2))
+                    print('ACTUAL: ', json.dumps(result, indent=2))
                 raise e
             result = get_jsonld_error_code(e)
-            self.assertEqual(result, data['expect'])
+            self.assertEqual(result, expect)
 
 
 def is_jsonld_type(node, type_):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git



More information about the Python-modules-commits mailing list