@@ -97,8 +97,21 @@ def test_merge_commit(repo_init_with_commit, commit_env_config, git2cpp_path, tm
9797 assert p_merge_2 .stdout == "Already up-to-date\n "
9898
9999
100- @pytest .mark .parametrize ("flag" , ["--abort" , "--quit" , "--continue" ])
101- def test_merge_conflict (repo_init_with_commit , commit_env_config , git2cpp_path , tmp_path , flag ):
100+ @pytest .mark .parametrize (
101+ "flag, abort_input" ,
102+ [
103+ ("--abort" , "y" ),
104+ ("--abort" , "Y" ),
105+ ("--abort" , "n" ),
106+ ("--abort" , "N" ),
107+ ("--abort" , "" ),
108+ ("--quit" , None ),
109+ ("--continue" , None ),
110+ ],
111+ )
112+ def test_merge_conflict (
113+ repo_init_with_commit , commit_env_config , git2cpp_path , tmp_path , flag , abort_input
114+ ):
102115 assert (tmp_path / "initial.txt" ).exists ()
103116
104117 checkout_cmd = [git2cpp_path , "checkout" , "-b" , "foregone" ]
@@ -140,18 +153,18 @@ def test_merge_conflict(repo_init_with_commit, commit_env_config, git2cpp_path,
140153
141154 flag_cmd = [git2cpp_path , "merge" , flag ]
142155 if flag == "--abort" :
143- for answer in { "y" , "" }:
144- p_abort = subprocess . run (
145- flag_cmd , input = answer , capture_output = True , cwd = tmp_path , text = True
146- )
147- assert p_abort .returncode == 0
148- assert (tmp_path / "mook_file.txt" ).exists ()
149- text = (tmp_path / "mook_file.txt" ).read_text ()
150- if answer == "y" :
151- assert "BLA" in text
152- assert "bla" not in text
153- else :
154- assert "Abort." in p_abort .stdout
156+ p_abort = subprocess . run (
157+ flag_cmd , input = abort_input , capture_output = True , cwd = tmp_path , text = True
158+ )
159+
160+ assert p_abort .returncode == 0
161+ assert (tmp_path / "mook_file.txt" ).exists ()
162+ text = (tmp_path / "mook_file.txt" ).read_text ()
163+ if abort_input . lower () == "y" :
164+ assert "BLA" in text
165+ assert "bla" not in text
166+ else :
167+ assert "Abort." in p_abort .stdout
155168
156169 elif flag == "--quit" :
157170 pass
0 commit comments