File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,9 @@ def validate(
332
332
results = super ().validate (toml_data , strict )
333
333
poetry_config = toml_data ["tool" ]["poetry" ]
334
334
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
+ )
336
338
337
339
# A project should not depend on itself.
338
340
# 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:
26
26
).read ()
27
27
assert Factory .validate (toml ) == {
28
28
"errors" : [
29
- "data .source[0].priority must be one of ['primary',"
29
+ "tool.poetry .source[0].priority must be one of ['primary',"
30
30
" 'supplemental', 'explicit']"
31
31
],
32
32
"warnings" : [],
@@ -41,7 +41,7 @@ def test_self_valid() -> None:
41
41
def test_self_invalid_version () -> None :
42
42
toml : dict [str , Any ] = TOMLFile (FIXTURE_DIR / "self_invalid_version.toml" ).read ()
43
43
assert Factory .validate (toml ) == {
44
- "errors" : ["data .requires-poetry must be string" ],
44
+ "errors" : ["tool.poetry .requires-poetry must be string" ],
45
45
"warnings" : [],
46
46
}
47
47
@@ -50,7 +50,7 @@ def test_self_invalid_plugin() -> None:
50
50
toml : dict [str , Any ] = TOMLFile (FIXTURE_DIR / "self_invalid_plugin.toml" ).read ()
51
51
assert Factory .validate (toml ) == {
52
52
"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"
54
54
" (0 matches found)"
55
55
],
56
56
"warnings" : [],
Original file line number Diff line number Diff line change @@ -392,13 +392,17 @@ def test_validate_fails(fixture_dir: FixtureDirGetter) -> None:
392
392
complete = TOMLFile (fixture_dir ("complete.toml" ))
393
393
pyproject : dict [str , Any ] = complete .read ()
394
394
pyproject ["tool" ]["poetry" ]["this key is not in the schema" ] = ""
395
+ pyproject ["tool" ]["poetry" ]["source" ] = {}
395
396
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
+ ]
400
404
401
- assert Factory .validate (pyproject ) == {"errors" : [ expected ] , "warnings" : []}
405
+ assert Factory .validate (pyproject ) == {"errors" : expected , "warnings" : []}
402
406
403
407
404
408
def test_create_poetry_fails_on_invalid_configuration (
You can’t perform that action at this time.
0 commit comments