mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-11 10:46:52 +00:00
fix(ingest): hint at --update-golden-files option when tests fail (#8507)
This commit is contained in:
parent
8a23c37e7c
commit
c585a1bcc7
@ -45,7 +45,7 @@ def assert_metadata_files_equal(
|
|||||||
|
|
||||||
if copy_output:
|
if copy_output:
|
||||||
shutil.copyfile(str(output_path), str(golden_path) + ".output")
|
shutil.copyfile(str(output_path), str(golden_path) + ".output")
|
||||||
print(f"Copied output file to {golden_path}.output")
|
logger.info(f"Copied output file to {golden_path}.output")
|
||||||
|
|
||||||
if not update_golden and not golden_exists:
|
if not update_golden and not golden_exists:
|
||||||
raise FileNotFoundError(
|
raise FileNotFoundError(
|
||||||
@ -77,11 +77,15 @@ def assert_metadata_files_equal(
|
|||||||
|
|
||||||
if diff:
|
if diff:
|
||||||
# Call pytest.fail rather than raise an exception to omit stack trace
|
# Call pytest.fail rather than raise an exception to omit stack trace
|
||||||
|
message = (
|
||||||
|
"Metadata files differ (use `pytest --update-golden-files` to update):\n"
|
||||||
|
)
|
||||||
if isinstance(diff, MCPDiff):
|
if isinstance(diff, MCPDiff):
|
||||||
print(diff.pretty(verbose=True))
|
logger.error(message + diff.pretty(verbose=True))
|
||||||
pytest.fail(diff.pretty(), pytrace=False)
|
pytest.fail(message + diff.pretty(), pytrace=False)
|
||||||
else:
|
else:
|
||||||
pytest.fail(pprint.pformat(diff), pytrace=False)
|
logger.error(message + pprint.pformat(diff))
|
||||||
|
pytest.fail(message + pprint.pformat(diff), pytrace=False)
|
||||||
|
|
||||||
|
|
||||||
def diff_metadata_json(
|
def diff_metadata_json(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user