From ae7fcab53fb6df8a037ee9da7ac950b00c1ea746 Mon Sep 17 00:00:00 2001 From: Wagner Macedo Date: Wed, 17 Nov 2021 00:35:02 +0100 Subject: [PATCH] Forward compatibility for multiple readme files This makes poetry aware about the upcoming changes in poetry-core in order to support declaration of multiple readme files in pyproject.toml Relates python-poetry/poetry#873 Enable python-poetry/poetry-core#248 --- src/poetry/json/schemas/poetry-schema.json | 15 +++++++++++++-- tests/test_factory.py | 6 +++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/poetry/json/schemas/poetry-schema.json b/src/poetry/json/schemas/poetry-schema.json index fe916f1e04e..b5b5bab77a8 100644 --- a/src/poetry/json/schemas/poetry-schema.json +++ b/src/poetry/json/schemas/poetry-schema.json @@ -54,8 +54,19 @@ "$ref": "#/definitions/maintainers" }, "readme": { - "type": "string", - "description": "The path to the README file" + "anyOf": [ + { + "type": "string", + "description": "The path to the README file." + }, + { + "type": "array", + "description": "A list of paths to the readme files.", + "items": { + "type": "string" + } + } + ] }, "classifiers": { "type": "array", diff --git a/tests/test_factory.py b/tests/test_factory.py index bb632cc9a26..b4c88fdb8ca 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -25,6 +25,10 @@ def test_create_poetry(): poetry = Factory().create_poetry(fixtures_dir / "sample_project") package = poetry.package + if hasattr(package, "readmes"): + single_readme = package.readmes[0] + else: + single_readme = package.readme assert package.name == "my-package" assert package.version.text == "1.2.3" @@ -32,7 +36,7 @@ def test_create_poetry(): assert package.authors == ["Sébastien Eustace "] assert package.license.id == "MIT" assert ( - package.readme.relative_to(fixtures_dir).as_posix() + single_readme.relative_to(fixtures_dir).as_posix() == "sample_project/README.rst" ) assert package.homepage == "https://python-poetry.org"