fix(factory): safe get extras
in scripts and config
#404
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: python-poetry/poetry#4665
Updated documentation for changed code.Not applicableAccording to:
poetry-core/src/poetry/core/json/schemas/poetry-schema.json
Lines 6 to 10 in 3bf7ad0
poetry-core/src/poetry/core/json/schemas/poetry-schema.json
Lines 597 to 600 in 3bf7ad0
extras
is not required in the main config (underpoetry.tools.extras
)extras
is not required when defining a script (underpoetry.tools.scripts
) using the syntax introduced in Added script file feature #40Despite that,
Factory.validate
assumes thatextras
key is always present for both cases by hard accessing it, making the script definition fail for 2 possible reasons:poetry.tool.extras
is not defined at allextras
keyThis PR fixes those 2 use cases by soft accessing the key and defaulting to an empty list/dict.
It also adds tests to validate the errors/warnings that could happen when using the
strict
flag, since it was lacking some coverage.