summaryrefslogtreecommitdiff
path: root/ext_tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2016-02-13 15:42:27 +0100
committerStefan Kögl <stefan@skoegl.net>2016-02-13 15:42:27 +0100
commitcf0da04dca7a5fcb3f20ab6a4eb78faf9dac8ce5 (patch)
tree7fcc9f4a8da0f65dd1f5e95e6aa65b3506d568ea /ext_tests.py
parent4443d3241b8e11e691d4700b37db469120993d9d (diff)
downloadpython-json-patch-cf0da04dca7a5fcb3f20ab6a4eb78faf9dac8ce5.tar.gz
Print test comments when external tests fail
Makes it easier to locate the failing tests in the test file
Diffstat (limited to 'ext_tests.py')
-rwxr-xr-xext_tests.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext_tests.py b/ext_tests.py
index 5e5ded8..0e1404c 100755
--- a/ext_tests.py
+++ b/ext_tests.py
@@ -60,12 +60,15 @@ class TestCaseTemplate(unittest.TestCase):
)
else:
- res = jsonpatch.apply_patch(test['doc'], test['patch'])
+ try:
+ res = jsonpatch.apply_patch(test['doc'], test['patch'])
+ except jsonpatch.JsonPatchException as jpe:
+ raise Exception(test.get('comment', '')) from jpe
# if there is no 'expected' we only verify that applying the patch
# does not raies an exception
if 'expected' in test:
- self.assertEquals(res, test['expected'])
+ self.assertEquals(res, test['expected'], test.get('comment', ''))
def make_test_case(tests):