@@ -565,38 +565,6 @@ def test_run_exception_handling(agent_setup, build_env_info):
565565 agent .run (env )
566566
567567
568- def test_apply_patch_success (agent_setup , tmp_path ):
569- """Test successful patch application"""
570- agent , _ , _ = next (agent_setup (DebugAgent ))
571-
572- # Create a test patch file
573- patch_content = "--- a/test.txt\n +++ b/test.txt\n @@ -1 +1 @@\n -old\n +new\n "
574- patch_file = tmp_path / "test.patch"
575- patch_file .write_text (patch_content )
576-
577- with patch ("subprocess.run" ) as mock_run :
578- mock_run .return_value = MagicMock (stdout = "Patch applied successfully" )
579- result = agent .apply_patch (str (patch_file ))
580- assert result is True
581- mock_run .assert_called_once ()
582-
583-
584- def test_apply_patch_failure (agent_setup , tmp_path ):
585- """Test failed patch application"""
586- agent , _ , _ = next (agent_setup (DebugAgent ))
587-
588- # Create a test patch file
589- patch_file = tmp_path / "test.patch"
590- patch_file .write_text ("invalid patch content" )
591-
592- with patch ("subprocess.run" ) as mock_run :
593- mock_run .side_effect = subprocess .CalledProcessError (
594- 1 , "patch" , stderr = "Patch failed"
595- )
596- result = agent .apply_patch (str (patch_file ))
597- assert result is False
598-
599-
600568def test_save_patch (agent_setup , tmp_path ):
601569 """Test patch saving functionality"""
602570 agent , env , _ = next (agent_setup (DebugAgent ))
0 commit comments