@@ -66,37 +66,77 @@ def test_ensure_config_are_equal(
66
66
67
67
68
68
@pytest .mark .parametrize (
69
- ("with_base" , "args" , "config" ),
69
+ ("with_base" , "args" , "config" , "expected" ),
70
70
(
71
- (True , ["--fix" ], "test/fixtures/config-with-write-all.yml" ),
72
- (True , ["--fix=all" ], "test/fixtures/config-with-write-all.yml" ),
73
- (True , ["--fix" , "all" ], "test/fixtures/config-with-write-all.yml" ),
74
- (True , ["--fix=none" ], "test/fixtures/config-with-write-none.yml" ),
75
- (True , ["--fix" , "none" ], "test/fixtures/config-with-write-none.yml" ),
76
- (
71
+ pytest .param (
72
+ True ,
73
+ ["--fix" ],
74
+ "test/fixtures/config-with-write-all.yml" ,
75
+ [],
76
+ id = "1" ,
77
+ ),
78
+ pytest .param (
79
+ True ,
80
+ ["--fix=all" ],
81
+ "test/fixtures/config-with-write-all.yml" ,
82
+ ["all" ],
83
+ id = "2" ,
84
+ ),
85
+ pytest .param (
86
+ True ,
87
+ ["--fix" , "all" ],
88
+ "test/fixtures/config-with-write-all.yml" ,
89
+ ["all" ],
90
+ id = "3" ,
91
+ ),
92
+ pytest .param (
93
+ True ,
94
+ ["--fix=none" ],
95
+ "test/fixtures/config-with-write-none.yml" ,
96
+ [],
97
+ id = "4" ,
98
+ ),
99
+ pytest .param (
100
+ True ,
101
+ ["--fix" , "none" ],
102
+ "test/fixtures/config-with-write-none.yml" ,
103
+ [],
104
+ id = "5" ,
105
+ ),
106
+ pytest .param (
77
107
True ,
78
108
["--fix=rule-tag,rule-id" ],
79
109
"test/fixtures/config-with-write-subset.yml" ,
110
+ ["rule-tag" , "rule-id" ],
111
+ id = "6" ,
80
112
),
81
- (
113
+ pytest . param (
82
114
True ,
83
115
["--fix" , "rule-tag,rule-id" ],
84
116
"test/fixtures/config-with-write-subset.yml" ,
117
+ ["rule-tag" , "rule-id" ],
118
+ id = "7" ,
85
119
),
86
- (
120
+ pytest . param (
87
121
True ,
88
122
["--fix" , "rule-tag" , "--fix" , "rule-id" ],
89
123
"test/fixtures/config-with-write-subset.yml" ,
124
+ ["rule-tag" , "rule-id" ],
125
+ id = "8" ,
90
126
),
91
- (
127
+ pytest . param (
92
128
False ,
93
129
["--fix" , "examples/playbooks/example.yml" ],
94
130
"test/fixtures/config-with-write-all.yml" ,
131
+ [],
132
+ id = "9" ,
95
133
),
96
- (
134
+ pytest . param (
97
135
False ,
98
136
["--fix" , "examples/playbooks/example.yml" , "non-existent.yml" ],
99
137
"test/fixtures/config-with-write-all.yml" ,
138
+ [],
139
+ id = "10" ,
100
140
),
101
141
),
102
142
)
@@ -105,6 +145,7 @@ def test_ensure_write_cli_does_not_consume_lintables(
105
145
with_base : bool ,
106
146
args : list [str ],
107
147
config : str ,
148
+ expected : list [str ],
108
149
) -> None :
109
150
"""Check equality of the CLI --fix options to config files."""
110
151
cli_parser = cli .get_cli_parser ()
@@ -113,13 +154,14 @@ def test_ensure_write_cli_does_not_consume_lintables(
113
154
options = cli_parser .parse_args (command )
114
155
file_config = cli .load_config (config )[0 ]
115
156
116
- file_value = file_config .get ("write_list" )
157
+ file_config .get ("write_list" )
117
158
orig_cli_value = options .write_list
118
159
cli_value = cli .WriteArgAction .merge_fix_list_config (
119
160
from_file = [],
120
161
from_cli = orig_cli_value ,
121
162
)
122
- assert file_value == cli_value
163
+ # breakpoint()
164
+ assert cli_value == expected
123
165
124
166
125
167
def test_config_can_be_overridden (base_arguments : list [str ]) -> None :
0 commit comments