File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -332,7 +332,9 @@ def validate(
332332 results = super ().validate (toml_data , strict )
333333 poetry_config = toml_data ["tool" ]["poetry" ]
334334
335- results ["errors" ].extend (validate_object (poetry_config ))
335+ results ["errors" ].extend (
336+ [e .replace ("data." , "tool.poetry." ) for e in validate_object (poetry_config )]
337+ )
336338
337339 # A project should not depend on itself.
338340 # TODO: consider [project.dependencies] and [project.optional-dependencies]
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def test_pyproject_toml_invalid_priority() -> None:
2626 ).read ()
2727 assert Factory .validate (toml ) == {
2828 "errors" : [
29- "data .source[0].priority must be one of ['primary',"
29+ "tool.poetry .source[0].priority must be one of ['primary',"
3030 " 'supplemental', 'explicit']"
3131 ],
3232 "warnings" : [],
@@ -41,7 +41,7 @@ def test_self_valid() -> None:
4141def test_self_invalid_version () -> None :
4242 toml : dict [str , Any ] = TOMLFile (FIXTURE_DIR / "self_invalid_version.toml" ).read ()
4343 assert Factory .validate (toml ) == {
44- "errors" : ["data .requires-poetry must be string" ],
44+ "errors" : ["tool.poetry .requires-poetry must be string" ],
4545 "warnings" : [],
4646 }
4747
@@ -50,7 +50,7 @@ def test_self_invalid_plugin() -> None:
5050 toml : dict [str , Any ] = TOMLFile (FIXTURE_DIR / "self_invalid_plugin.toml" ).read ()
5151 assert Factory .validate (toml ) == {
5252 "errors" : [
53- "data .requires-plugins.foo must be valid exactly by one definition"
53+ "tool.poetry .requires-plugins.foo must be valid exactly by one definition"
5454 " (0 matches found)"
5555 ],
5656 "warnings" : [],
Original file line number Diff line number Diff line change @@ -392,13 +392,17 @@ def test_validate_fails(fixture_dir: FixtureDirGetter) -> None:
392392 complete = TOMLFile (fixture_dir ("complete.toml" ))
393393 pyproject : dict [str , Any ] = complete .read ()
394394 pyproject ["tool" ]["poetry" ]["this key is not in the schema" ] = ""
395+ pyproject ["tool" ]["poetry" ]["source" ] = {}
395396
396- expected = (
397- "Additional properties are not allowed "
398- "('this key is not in the schema' was unexpected)"
399- )
397+ expected = [
398+ "tool.poetry.source must be array" ,
399+ (
400+ "Additional properties are not allowed "
401+ "('this key is not in the schema' was unexpected)"
402+ ),
403+ ]
400404
401- assert Factory .validate (pyproject ) == {"errors" : [ expected ] , "warnings" : []}
405+ assert Factory .validate (pyproject ) == {"errors" : expected , "warnings" : []}
402406
403407
404408def test_create_poetry_fails_on_invalid_configuration (
You can’t perform that action at this time.
0 commit comments