Skip to content

Commit

Permalink
Forward compatibility for multiple readme files
Browse files Browse the repository at this point in the history
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#873
Enable python-poetry/poetry-core#248
  • Loading branch information
wagnerluis1982 committed Nov 16, 2021
1 parent 25cc6a1 commit ae7fcab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/poetry/json/schemas/poetry-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ 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"
assert package.description == "Some description."
assert package.authors == ["Sébastien Eustace <sebastien@eustace.io>"]
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"
Expand Down

0 comments on commit ae7fcab

Please sign in to comment.