Print test comments when external tests fail
Makes it easier to locate the failing tests in the test file
This commit is contained in:
		| @@ -60,12 +60,15 @@ class TestCaseTemplate(unittest.TestCase): | |||||||
|                 ) |                 ) | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|  |             try: | ||||||
|                 res = jsonpatch.apply_patch(test['doc'], test['patch']) |                 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 |             # if there is no 'expected' we only verify that applying the patch | ||||||
|             # does not raies an exception |             # does not raies an exception | ||||||
|             if 'expected' in test: |             if 'expected' in test: | ||||||
|                 self.assertEquals(res, test['expected']) |                 self.assertEquals(res, test['expected'], test.get('comment', '')) | ||||||
|  |  | ||||||
|  |  | ||||||
| def make_test_case(tests): | def make_test_case(tests): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stefan Kögl
					Stefan Kögl