From 268d8cc43cf500a8f969be1906587bce4faa3cb1 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 19 Dec 2019 11:08:51 -0500 Subject: [PATCH] Employ more elegant error reporting in tests --- tests/test_definitions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_definitions.py b/tests/test_definitions.py index e37f0e3d..f66f2bd2 100644 --- a/tests/test_definitions.py +++ b/tests/test_definitions.py @@ -3,6 +3,7 @@ import json import pytest import yaml from jsonschema import validate +from jsonschema.exceptions import ValidationError def _get_definition_files(): @@ -27,4 +28,7 @@ def test_definition(file_path): definition = yaml.load(definition_file.read(), Loader=yaml.SafeLoader) # Run validation - validate(definition, schema=schema) + try: + validate(definition, schema=schema) + except ValidationError as e: + pytest.fail(f"{file_path} failed validation: {e}")