Skip to content

Commit 0c28543

Browse files
committed
Merge in upstream changes
1 parent 4858ce5 commit 0c28543

File tree

5 files changed

+23
-30
lines changed

5 files changed

+23
-30
lines changed

src/cfnlint/config.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,6 @@ class ManualArgs(TypedDict, total=False):
696696
regions: list
697697
registry_schemas: list[str]
698698
template_parameters: list[dict[str, Any]]
699-
parameters: list[dict[str, Any]]
700699
parameters: list[ParameterSet]
701700
parameter_files: list[str]
702701
templates: list[str]
@@ -756,20 +755,16 @@ def __repr__(self):
756755
"ignore_checks": self.ignore_checks,
757756
"include_checks": self.include_checks,
758757
"include_experimental": self.include_experimental,
759-
"configure_rules": self.configure_rules,
760-
"registry_schemas": self.registry_schemas,
761-
"regions": self.regions,
762-
"ignore_bad_template": self.ignore_bad_template,
763-
"debug": self.debug,
764758
"info": self.info,
765759
"mandatory_checks": self.mandatory_checks,
766760
"merge_configs": self.merge_configs,
767761
"non_zero_exit_code": self.non_zero_exit_code,
768-
"patch_specs": self.patch_specs,
769762
"override_spec": self.override_spec,
770763
"parameter_files": self.parameter_files,
771764
"parameters": self.parameters,
765+
"patch_specs": self.patch_specs,
772766
"regions": self.regions,
767+
"registry_schemas": self.registry_schemas,
773768
"templates": self.templates,
774769
}
775770
)

src/cfnlint/runner/cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from cfnlint.config import ConfigMixIn, configure_logging
1616
from cfnlint.exceptions import CfnLintExitException, UnexpectedRuleException
1717
from cfnlint.rules import Match, Rules
18-
from cfnlint.schema import PROVIDER_SCHEMA_MANAGER, patch
1918
from cfnlint.rules.errors import ConfigError
2019
from cfnlint.runner.deployment_file.runner import expand_deployment_files
2120
from cfnlint.runner.parameter_file.runner import expand_parameter_files
@@ -24,7 +23,7 @@
2423
run_template_by_file_paths,
2524
run_template_by_pipe,
2625
)
27-
from cfnlint.schema import PROVIDER_SCHEMA_MANAGER
26+
from cfnlint.schema import PROVIDER_SCHEMA_MANAGER, patch
2827

2928
LOGGER = logging.getLogger(__name__)
3029

test/unit/module/runner/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_print_help(self, mock_isatty, mock_print_help):
9393

9494
self.assertEqual(e.exception.code, 1)
9595
mock_print_help.assert_called_once()
96-
self.assertEqual(mock_isatty.call_count, 2)
96+
self.assertEqual(mock_isatty.call_count, 3)
9797

9898
def test_bad_regions(self):
9999
config = ConfigMixIn(

test/unit/module/runner/test_runner.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99
import pytest
1010

1111
from cfnlint.config import ConfigMixIn
12-
<<<<<<< HEAD
13-
from cfnlint.runner import PROVIDER_SCHEMA_MANAGER, Runner
14-
from cfnlint.schema import Schema, reset
15-
=======
1612
from cfnlint.runner import Runner
17-
from cfnlint.schema import PROVIDER_SCHEMA_MANAGER, Schema
18-
>>>>>>> 04a759a4a (Allow for deployment files)
13+
from cfnlint.schema import PROVIDER_SCHEMA_MANAGER, Schema, reset
1914

2015

2116
def patch_registry(path):
@@ -77,7 +72,7 @@ def test_init_schemas(name, registry_path, patch_path, expected):
7772
with patch.object(
7873
PROVIDER_SCHEMA_MANAGER, "load_registry_schemas", new=patch_registry
7974
):
80-
with patch("cfnlint.runner.patch", new=patch_schema):
75+
with patch("cfnlint.runner.cli.patch", new=patch_schema):
8176
Runner(config)
8277

8378
if registry_path:

test/unit/rules/functions/test_basefn.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,30 @@ def template():
3232

3333

3434
@pytest.mark.parametrize(
35-
"name,instance,schema,parameters,expected",
35+
"name,rule,instance,parameters,expected",
3636
[
3737
(
3838
"Dynamic references are ignored",
3939
{
4040
"schema": {
4141
"enum": ["Foo"],
4242
},
43-
"patches": [],
4443
},
4544
{"Fn::Sub": "{{resolve:ssm:${AWS::AccountId}/${AWS::Region}/ac}}"},
4645
[],
4746
[],
4847
),
49-
("Everything is fine", {"Fn::Sub": "Foo"}, {"enum": ["Foo"]}, {}, []),
48+
(
49+
"Everything is fine",
50+
{"schema": {"enum": ["Foo"]}},
51+
{"Fn::Sub": "Foo"},
52+
{},
53+
[],
54+
),
5055
(
5156
"Resolved Fn::Sub has no strict type validation",
5257
{
5358
"schema": {"type": ["integer"]},
54-
"patches": [],
5559
},
5660
{"Fn::Sub": "2"},
5761
[],
@@ -61,10 +65,8 @@ def template():
6165
"Standard error",
6266
{
6367
"schema": {"enum": ["Foo"]},
64-
"patches": [],
6568
},
6669
{"Fn::Sub": "Bar"},
67-
{"enum": ["Foo"]},
6870
[],
6971
[
7072
ValidationError(
@@ -83,10 +85,8 @@ def template():
8385
"Errors with context error",
8486
{
8587
"schema": {"anyOf": [{"enum": ["Foo"]}]},
86-
"patches": [],
8788
},
8889
{"Fn::Sub": "Bar"},
89-
{"anyOf": [{"enum": ["Foo"]}]},
9090
[],
9191
[
9292
ValidationError(
@@ -116,8 +116,10 @@ def template():
116116
),
117117
(
118118
"Ref of a parameter with parameter set",
119+
{
120+
"schema": {"enum": ["Foo"]},
121+
},
119122
{"Ref": "MyString"},
120-
{"enum": ["Foo"]},
121123
[
122124
ParameterSet(
123125
parameters={"MyString": "Bar"},
@@ -139,8 +141,10 @@ def template():
139141
),
140142
(
141143
"Fn::Sub of a parameter with parameter set",
144+
{
145+
"schema": {"enum": ["Foo"]},
146+
},
142147
{"Fn::Sub": "${MyString}"},
143-
{"enum": ["Foo"]},
144148
[
145149
ParameterSet(
146150
parameters={"MyString": "Bar"},
@@ -161,8 +165,8 @@ def template():
161165
],
162166
),
163167
],
164-
indirect=["parameters"],
168+
indirect=["rule", "parameters"],
165169
)
166-
def test_resolve(name, instance, schema, parameters, expected, validator, rule):
167-
errs = list(rule.resolve(validator, schema, instance, {}))
170+
def test_resolve(name, instance, parameters, rule, expected, validator):
171+
errs = list(rule.resolve(validator, rule._schema, instance, {}))
168172
assert errs == expected, f"{name!r} failed and got errors {errs!r}"

0 commit comments

Comments
 (0)