From 445e6cc32ff7e1162505cea9bded65079ce28a02 Mon Sep 17 00:00:00 2001 From: Tiago Nobrega Date: Fri, 21 Jun 2024 15:39:25 -0300 Subject: [PATCH] fixup! fix: don't raise CraftValidationErrors in validators --- rockcraft/models/project.py | 4 +--- tests/spread/rockcraft/invalid-name/task.yaml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/rockcraft/models/project.py b/rockcraft/models/project.py index 774ba2cc1..22c4a0eef 100644 --- a/rockcraft/models/project.py +++ b/rockcraft/models/project.py @@ -183,9 +183,7 @@ def _validate_all_platforms(cls, platforms: dict[str, Any]) -> dict[str, Any]: try: platform = Platform(**platform).dict() except pydantic.ValidationError as err: - errors = [] - for err_dict in err.errors(): - errors.append(err_dict["msg"]) + errors = [err_dict["msg"] for err_dict in err.errors()] full_errors = ",".join(errors) raise ValueError(f"{error_prefix}: {full_errors}") from None diff --git a/tests/spread/rockcraft/invalid-name/task.yaml b/tests/spread/rockcraft/invalid-name/task.yaml index 9b64999c0..1de83f0af 100644 --- a/tests/spread/rockcraft/invalid-name/task.yaml +++ b/tests/spread/rockcraft/invalid-name/task.yaml @@ -4,5 +4,5 @@ execute: | for name in a_a a@a a--a aa- do sed "s/placeholder-name/$name/" rockcraft.orig.yaml > rockcraft.yaml - rockcraft pack 2>&1 >/dev/null | MATCH "Invalid name for rock" + rockcraft pack 2>&1 >/dev/null | MATCH "invalid name for rock" done \ No newline at end of file