Skip to content

Commit

Permalink
test: add prettydiff for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jnicoulaud-ledger committed Sep 24, 2024
1 parent 2e20c1d commit 2a6f59f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
29 changes: 28 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ dev = [
"pytest-datadir-ng>=1.1.1",
"ruff>=0.6.3",
"ruff-lsp>=0.0.55",
"prettydiff[terminal]>=0.1.0",
]

[tool.pdm.version]
Expand Down
2 changes: 2 additions & 0 deletions tests/src/erc7730/common/test_datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import glob
import json
from jsonschema import validate, exceptions
from prettydiff import print_diff

files = glob.glob("clear-signing-erc7730-registry/registry/*/*.json")
with open("clear-signing-erc7730-registry/specs/erc7730-v1.schema.json", "r") as file:
Expand All @@ -23,4 +24,5 @@ def test_from_erc7730(file: str) -> None:
validate(instance=json_from_model, schema=schema)
except exceptions.ValidationError as ex:
pytest.fail(f"Invalid schema for serialized data from {file}: {ex}")
print_diff(json_from_model, original_dict_with_includes)
assert json_from_model == original_dict_with_includes

0 comments on commit 2a6f59f

Please sign in to comment.