@@ -240,10 +240,7 @@ def test_pin_matrix_add(
240240 config_file = tmp_path / ".vcspull.yaml"
241241
242242 # Pre-populate config with existing entry
243- config_file .write_text (
244- yaml .dump ({"~/code/" : {"myrepo" : _entry (_OLD_URL , options )}}),
245- encoding = "utf-8" ,
246- )
243+ save_config_yaml (config_file , {"~/code/" : {"myrepo" : _entry (_OLD_URL , options )}})
247244
248245 # Try to add same repo name with a different URL
249246 add_repo (
@@ -304,10 +301,7 @@ def test_pin_matrix_discover(
304301 config_file = tmp_path / ".vcspull.yaml"
305302
306303 # Pre-populate config with existing entry at old URL
307- config_file .write_text (
308- yaml .dump ({"~/code/" : {"myrepo" : _entry (_OLD_URL , options )}}),
309- encoding = "utf-8" ,
310- )
304+ save_config_yaml (config_file , {"~/code/" : {"myrepo" : _entry (_OLD_URL , options )}})
311305
312306 discover_repos (
313307 scan_dir_str = str (scan_dir ),
@@ -367,10 +361,7 @@ def test_pin_matrix_fmt(
367361 # Compact string entry — fmt normalizes to {"repo": url}
368362 entry_data = _OLD_URL
369363
370- config_file .write_text (
371- yaml .dump ({"~/projects/" : {"myrepo" : entry_data }}),
372- encoding = "utf-8" ,
373- )
364+ save_config_yaml (config_file , {"~/projects/" : {"myrepo" : entry_data }})
374365
375366 format_config_file (str (config_file ), write = True , format_all = False )
376367
@@ -509,10 +500,7 @@ def test_pin_reason_in_log(
509500
510501 elif operation == "add" :
511502 config_file = tmp_path / ".vcspull.yaml"
512- config_file .write_text (
513- yaml .dump ({"~/code/" : {"myrepo" : entry }}),
514- encoding = "utf-8" ,
515- )
503+ save_config_yaml (config_file , {"~/code/" : {"myrepo" : entry }})
516504 add_repo (
517505 name = "myrepo" ,
518506 url = _NEW_URL ,
@@ -529,10 +517,7 @@ def test_pin_reason_in_log(
529517 repo_path = scan_dir / "myrepo"
530518 _init_git_repo (repo_path , _NEW_URL )
531519 config_file = tmp_path / ".vcspull.yaml"
532- config_file .write_text (
533- yaml .dump ({"~/code/" : {"myrepo" : entry }}),
534- encoding = "utf-8" ,
535- )
520+ save_config_yaml (config_file , {"~/code/" : {"myrepo" : entry }})
536521 discover_repos (
537522 scan_dir_str = str (scan_dir ),
538523 config_file_path_str = str (config_file ),
@@ -550,10 +535,7 @@ def test_pin_reason_in_log(
550535 elif operation == "fmt" :
551536 config_file = tmp_path / ".vcspull.yaml"
552537 fmt_entry = {"url" : _OLD_URL , "options" : pin_options }
553- config_file .write_text (
554- yaml .dump ({"~/projects/" : {"myrepo" : fmt_entry }}),
555- encoding = "utf-8" ,
556- )
538+ save_config_yaml (config_file , {"~/projects/" : {"myrepo" : fmt_entry }})
557539 format_config_file (str (config_file ), write = True , format_all = False )
558540 # fmt silently preserves pinned entries; verify pin_reason survives
559541 with config_file .open () as f :
0 commit comments