diff options
author | Stefan Kögl <stefan@skoegl.net> | 2016-02-13 15:42:27 +0100 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2016-02-13 15:42:27 +0100 |
commit | cf0da04dca7a5fcb3f20ab6a4eb78faf9dac8ce5 (patch) | |
tree | 7fcc9f4a8da0f65dd1f5e95e6aa65b3506d568ea | |
parent | 4443d3241b8e11e691d4700b37db469120993d9d (diff) | |
download | python-json-patch-cf0da04dca7a5fcb3f20ab6a4eb78faf9dac8ce5.tar.gz |
Print test comments when external tests fail
Makes it easier to locate the failing tests in the test file
-rwxr-xr-x | ext_tests.py | 7 |
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): |