From b3cc17745eadfe4eb9d3ee840ded4dd1bf741eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Sat, 13 Jul 2024 21:33:15 +0200 Subject: [PATCH] invalid --- tests/json/fixtures/self_invalid_plugin.toml | 8 ++++++++ tests/json/test_schema.py | 12 ++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/json/fixtures/self_invalid_plugin.toml diff --git a/tests/json/fixtures/self_invalid_plugin.toml b/tests/json/fixtures/self_invalid_plugin.toml new file mode 100644 index 00000000000..bcd5ea63dc8 --- /dev/null +++ b/tests/json/fixtures/self_invalid_plugin.toml @@ -0,0 +1,8 @@ +[tool.poetry] +name = "foobar" +version = "0.1.0" +description = "" +authors = ["Your Name "] + +[tool.poetry.self.plugins] +foo = 5 diff --git a/tests/json/test_schema.py b/tests/json/test_schema.py index d2474b0136e..13580a0aed7 100644 --- a/tests/json/test_schema.py +++ b/tests/json/test_schema.py @@ -61,6 +61,18 @@ def test_self_valid() -> None: assert Factory.validate(content) == {"errors": [], "warnings": []} +def test_self_invalid_plugin() -> None: + toml: dict[str, Any] = TOMLFile(FIXTURE_DIR / "self_invalid_plugin.toml").read() + content = toml["tool"]["poetry"] + assert Factory.validate(content) == { + "errors": [ + "data.self.plugins.foo must be valid exactly by one definition" + " (0 matches found)" + ], + "warnings": [], + } + + def test_dependencies_is_consistent_to_poetry_core_schema() -> None: with (SCHEMA_DIR / "poetry.json").open(encoding="utf-8") as f: schema = json.load(f)