mirror of
https://github.com/netravnen/devicetype-library.git
synced 2024-05-10 07:55:01 +00:00
Employ more elegant error reporting in tests
This commit is contained in:
@ -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}")
|
||||
|
Reference in New Issue
Block a user