From 56ebc45fb9e935492c8b4e215ca048df68e4422e Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Wed, 3 Aug 2022 13:17:45 +0200 Subject: [PATCH] Improve error message on schema validation (#220) * better error message * style: [pre-commit.ci] auto fixes [...] * Update npe2/manifest/schema.py Co-authored-by: Talley Lambert * fix precommit * no cover Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Talley Lambert --- npe2/manifest/schema.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/npe2/manifest/schema.py b/npe2/manifest/schema.py index cf843207..4b9c26c0 100644 --- a/npe2/manifest/schema.py +++ b/npe2/manifest/schema.py @@ -321,7 +321,11 @@ def _from_entrypoint( meta = PackageMetadata.from_dist_metadata(distribution.metadata) mf.package_metadata = meta - assert mf.name == meta.name, "Manifest name must match package name" + if mf.name != meta.name: + raise ValueError( # pragma: no cover + f"The name field in the manifest ({mf.name!r}) " + f"must match the package name ({meta.name!r})" + ) return mf raise FileNotFoundError( # pragma: no cover