@@ -32,7 +32,9 @@ def test_check_json_output(self):
3232 dev .write_text (json .dumps ({"host" : "localhost" }))
3333 prod .write_text (json .dumps ({"host" : "prod.example.com" , "port" : 443 }))
3434
35- result = runner .invoke (app , ["check" , str (dev ), str (prod ), "--output" , "json" ])
35+ result = runner .invoke (
36+ app , ["check" , str (dev ), str (prod ), "--output" , "json" ]
37+ )
3638 assert result .exit_code == 0
3739 data = json .loads (result .stdout )
3840 assert "target" in data
@@ -90,7 +92,6 @@ def test_check_less_than_two_files(self):
9092 assert result .exit_code == 1
9193 assert "Provide at least 2 config files" in result .stdout
9294
93-
9495 def test_check_with_custom_labels (self ):
9596 """Custom --baseline and --target labels should appear in output."""
9697 with tempfile .TemporaryDirectory () as tmpdir :
@@ -99,10 +100,18 @@ def test_check_with_custom_labels(self):
99100 dev .write_text (yaml .dump ({"host" : "localhost" }))
100101 prod .write_text (yaml .dump ({"host" : "prod.example.com" , "port" : 443 }))
101102
102- result = runner .invoke (app , [
103- "check" , str (dev ), str (prod ),
104- "--baseline" , "staging" , "--target" , "production" ,
105- ])
103+ result = runner .invoke (
104+ app ,
105+ [
106+ "check" ,
107+ str (dev ),
108+ str (prod ),
109+ "--baseline" ,
110+ "staging" ,
111+ "--target" ,
112+ "production" ,
113+ ],
114+ )
106115 assert result .exit_code == 0
107116 assert "staging" in result .stdout or "production" in result .stdout
108117 assert "host" in result .stdout
@@ -117,7 +126,9 @@ def test_scan_two_dirs(self):
117126 dev_dir .mkdir ()
118127 prod_dir .mkdir ()
119128 (dev_dir / "config.yaml" ).write_text (yaml .dump ({"host" : "localhost" }))
120- (prod_dir / "config.yaml" ).write_text (yaml .dump ({"host" : "prod.example.com" }))
129+ (prod_dir / "config.yaml" ).write_text (
130+ yaml .dump ({"host" : "prod.example.com" })
131+ )
121132
122133 result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir )])
123134 assert result .exit_code == 0
@@ -134,12 +145,16 @@ def test_scan_with_config_file(self):
134145 (dev_dir / "app.yaml" ).write_text (yaml .dump ({"host" : "localhost" }))
135146 (prod_dir / "app.yaml" ).write_text (yaml .dump ({"host" : "prod.example.com" }))
136147
137- cfg .write_text (yaml .dump ({
138- "environments" : {
139- "dev" : str (dev_dir ),
140- "prod" : str (prod_dir ),
141- }
142- }))
148+ cfg .write_text (
149+ yaml .dump (
150+ {
151+ "environments" : {
152+ "dev" : str (dev_dir ),
153+ "prod" : str (prod_dir ),
154+ }
155+ }
156+ )
157+ )
143158
144159 result = runner .invoke (app , ["scan" , "--config" , str (cfg )])
145160 assert result .exit_code == 0
@@ -151,7 +166,9 @@ def test_scan_baseline_not_found(self):
151166 dev_dir = Path (tmpdir ) / "dev"
152167 dev_dir .mkdir ()
153168 (dev_dir / "c.yaml" ).write_text (yaml .dump ({"k" : "v" }))
154- result = runner .invoke (app , ["scan" , str (dev_dir ), "--baseline" , "nonexistent" ])
169+ result = runner .invoke (
170+ app , ["scan" , str (dev_dir ), "--baseline" , "nonexistent" ]
171+ )
155172 assert result .exit_code == 1
156173 assert "not found" in result .stdout
157174
@@ -165,12 +182,13 @@ def test_scan_json_output(self):
165182 (dev_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "localhost" }))
166183 (prod_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "prod.example.com" }))
167184
168- result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "json" ])
185+ result = runner .invoke (
186+ app , ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "json" ]
187+ )
169188 assert result .exit_code == 0
170189 data = json .loads (result .stdout )
171190 assert "prod" in data
172191
173-
174192 def test_scan_nonexistent_dir_warning (self ):
175193 """Scan with a non-directory path should warn and skip."""
176194 with tempfile .TemporaryDirectory () as tmpdir :
@@ -205,8 +223,12 @@ def test_scan_breaking_drift_exit_code(self):
205223 prod_dir = Path (tmpdir ) / "prod"
206224 dev_dir .mkdir ()
207225 prod_dir .mkdir ()
208- (dev_dir / "c.yaml" ).write_text (yaml .dump ({"database_url" : "postgres://dev" }))
209- (prod_dir / "c.yaml" ).write_text (yaml .dump ({"database_url" : "postgres://prod" }))
226+ (dev_dir / "c.yaml" ).write_text (
227+ yaml .dump ({"database_url" : "postgres://dev" })
228+ )
229+ (prod_dir / "c.yaml" ).write_text (
230+ yaml .dump ({"database_url" : "postgres://prod" })
231+ )
210232
211233 result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir )])
212234 assert result .exit_code == 1
@@ -233,7 +255,9 @@ def test_scan_strict_exits_on_any_drift(self):
233255 assert result .exit_code == 0
234256
235257 # With --strict, any drift exits 1
236- result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir ), "--strict" ])
258+ result = runner .invoke (
259+ app , ["scan" , str (dev_dir ), str (prod_dir ), "--strict" ]
260+ )
237261 assert result .exit_code == 1
238262
239263 def test_scan_strict_no_drift_exits_zero (self ):
@@ -246,7 +270,9 @@ def test_scan_strict_no_drift_exits_zero(self):
246270 (dev_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "localhost" }))
247271 (prod_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "localhost" }))
248272
249- result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir ), "--strict" ])
273+ result = runner .invoke (
274+ app , ["scan" , str (dev_dir ), str (prod_dir ), "--strict" ]
275+ )
250276 assert result .exit_code == 0
251277
252278 def test_scan_silent_breaking_drift (self ):
@@ -256,10 +282,16 @@ def test_scan_silent_breaking_drift(self):
256282 prod_dir = Path (tmpdir ) / "prod"
257283 dev_dir .mkdir ()
258284 prod_dir .mkdir ()
259- (dev_dir / "c.yaml" ).write_text (yaml .dump ({"database_url" : "postgres://dev" }))
260- (prod_dir / "c.yaml" ).write_text (yaml .dump ({"database_url" : "postgres://prod" }))
261-
262- result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "silent" ])
285+ (dev_dir / "c.yaml" ).write_text (
286+ yaml .dump ({"database_url" : "postgres://dev" })
287+ )
288+ (prod_dir / "c.yaml" ).write_text (
289+ yaml .dump ({"database_url" : "postgres://prod" })
290+ )
291+
292+ result = runner .invoke (
293+ app , ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "silent" ]
294+ )
263295 assert result .exit_code == 1
264296
265297
@@ -280,7 +312,6 @@ def test_init_existing_file(self):
280312 assert result .exit_code == 1
281313 assert "already exists" in result .stdout
282314
283-
284315 def test_check_toml_files (self ):
285316 """Check command should work with TOML files."""
286317 with tempfile .TemporaryDirectory () as tmpdir :
@@ -329,7 +360,9 @@ def test_check_strict_silent_exits_on_any_drift(self):
329360 a .write_text (yaml .dump ({"host" : "localhost" }))
330361 b .write_text (yaml .dump ({"host" : "staging.example.com" }))
331362
332- result = runner .invoke (app , ["check" , str (a ), str (b ), "--output" , "silent" , "--strict" ])
363+ result = runner .invoke (
364+ app , ["check" , str (a ), str (b ), "--output" , "silent" , "--strict" ]
365+ )
333366 assert result .exit_code == 1
334367
335368 def test_check_strict_no_drift_exits_zero (self ):
@@ -365,7 +398,9 @@ def test_scan_env_and_toml_dirs(self):
365398 (dev_dir / "app.env" ).write_text ("HOST=localhost\n " )
366399 (prod_dir / "app.env" ).write_text ("HOST=prod.example.com\n " )
367400
368- result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "json" ])
401+ result = runner .invoke (
402+ app , ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "json" ]
403+ )
369404 assert result .exit_code == 0
370405 data = json .loads (result .stdout )
371406 assert "prod" in data
@@ -378,12 +413,20 @@ def test_scan_no_changes_env_skipped_in_table(self):
378413 prod_dir = Path (tmpdir ) / "prod"
379414 for d in [dev_dir , staging_dir , prod_dir ]:
380415 d .mkdir ()
381- (dev_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "localhost" , "port" : 8080 }))
416+ (dev_dir / "c.yaml" ).write_text (
417+ yaml .dump ({"host" : "localhost" , "port" : 8080 })
418+ )
382419 # staging is identical to dev — no changes
383- (staging_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "localhost" , "port" : 8080 }))
384- (prod_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "prod.example.com" , "port" : 8080 }))
385-
386- result = runner .invoke (app , ["scan" , str (dev_dir ), str (staging_dir ), str (prod_dir )])
420+ (staging_dir / "c.yaml" ).write_text (
421+ yaml .dump ({"host" : "localhost" , "port" : 8080 })
422+ )
423+ (prod_dir / "c.yaml" ).write_text (
424+ yaml .dump ({"host" : "prod.example.com" , "port" : 8080 })
425+ )
426+
427+ result = runner .invoke (
428+ app , ["scan" , str (dev_dir ), str (staging_dir ), str (prod_dir )]
429+ )
387430 assert result .exit_code == 0
388431 # Should show prod drift but skip staging (no changes)
389432 assert "prod" in result .stdout
0 commit comments