File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1515
1616
1717class FileFilters (pydantic .BaseModel ):
18+ model_config = pydantic .ConfigDict (extra = "forbid" )
19+
1820 include : tuple [str , ...] = pydantic .Field (
1921 default_factory = lambda : ("**/*" ,),
2022 description = (
@@ -34,6 +36,8 @@ class FileFilters(pydantic.BaseModel):
3436
3537
3638class SourceFiles (pydantic .BaseModel ):
39+ model_config = pydantic .ConfigDict (extra = "forbid" )
40+
3741 files : dict [ScopeName , FileFilters ] = pydantic .Field (
3842 description = (
3943 "Mapping of scope name to its file filters. "
@@ -44,6 +48,8 @@ class SourceFiles(pydantic.BaseModel):
4448
4549
4650class SourceManual (pydantic .BaseModel ):
51+ model_config = pydantic .ConfigDict (extra = "forbid" )
52+
4753 manual : None = pydantic .Field (
4854 description = "Scopes are manually sent via API or `mergify scopes-send`" ,
4955 )
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ def test_from_yaml_invalid_config(tmp_path: pathlib.Path) -> None:
106106 )
107107
108108 # Bad name and missing dict
109- with pytest .raises (config .ConfigInvalidError , match = "3 validation errors" ):
109+ with pytest .raises (config .ConfigInvalidError , match = "4 validation errors" ):
110110 config .Config .from_yaml (str (config_file ))
111111
112112
@@ -481,6 +481,22 @@ def test_detect_no_matches(
481481 assert result .scopes == set ()
482482
483483
484+ def test_match_scopes_invalid () -> None :
485+ with pytest .raises (config .ConfigInvalidError , match = "4 validation errors" ):
486+ config .Config .from_dict (
487+ {
488+ "scopes" : {
489+ "source" : {
490+ "files" : {
491+ "backend" : {"includes" : ("api/**/*.py" ,)},
492+ "frontend" : {"includes" : ("ui/**/*.js" ,)},
493+ },
494+ },
495+ },
496+ },
497+ )
498+
499+
484500@mock .patch ("mergify_cli.ci.scopes.changed_files.git_changed_files" )
485501def test_detect_debug_output (
486502 mock_git_changed : mock .Mock ,
You can’t perform that action at this time.
0 commit comments