Skip to content

Commit cf0da04

Browse files
committed
Print test comments when external tests fail
Makes it easier to locate the failing tests in the test file
1 parent 4443d32 commit cf0da04

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext_tests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ def _test(self, test):
6060
)
6161

6262
else:
63-
res = jsonpatch.apply_patch(test['doc'], test['patch'])
63+
try:
64+
res = jsonpatch.apply_patch(test['doc'], test['patch'])
65+
except jsonpatch.JsonPatchException as jpe:
66+
raise Exception(test.get('comment', '')) from jpe
6467

6568
# if there is no 'expected' we only verify that applying the patch
6669
# does not raies an exception
6770
if 'expected' in test:
68-
self.assertEquals(res, test['expected'])
71+
self.assertEquals(res, test['expected'], test.get('comment', ''))
6972

7073

7174
def make_test_case(tests):

0 commit comments

Comments
 (0)