@@ -691,15 +691,19 @@ def test_config_show_lsp_servers(self):
691691 self .assertIn ("lsp servers: (none configured" , buf .getvalue ())
692692
693693 def test_config_init_refuses_overwrite (self ):
694+ import io
695+ from contextlib import redirect_stdout
696+
694697 from python_agent_harness .cli import main
695698
696699 with tempfile .TemporaryDirectory () as d :
697700 p = Path (d ) / "config.json"
698701 p .write_text ('{"llm": {}}' , encoding = "utf-8" )
699- rc = main (["config" , "--init" , "--path" , str (p )])
702+ buf = io .StringIO ()
703+ with redirect_stdout (buf ):
704+ rc = main (["config" , "--init" , "--path" , str (p )])
700705 self .assertEqual (rc , 1 )
701- rc = main (["config" , "--init" , "--force" , "--path" , str (p )])
702- self .assertEqual (rc , 0 )
706+ self .assertIn ("delete it first" , buf .getvalue ())
703707
704708 def test_config_show_missing_file_message (self ):
705709 """config with a nonexistent path prints a hint, falls back to
@@ -723,9 +727,9 @@ def test_config_flag_both_positions(self):
723727 from python_agent_harness .cli import build_parser
724728
725729 parser = build_parser ()
726- before = parser .parse_args (["--config" , "/x.json" , "run" , "/tmp" ])
730+ before = parser .parse_args (["--config" , "/x.json" , "run" , "--project" , " /tmp" ])
727731 self .assertEqual (before .config , "/x.json" )
728- after = parser .parse_args (["run" , "/tmp" , "--config" , "/x.json" ])
732+ after = parser .parse_args (["run" , "--project" , " /tmp" , "--config" , "/x.json" ])
729733 self .assertEqual (after .config , "/x.json" )
730734 plain = parser .parse_args (["config" ])
731735 self .assertIsNone (plain .config )
@@ -735,9 +739,9 @@ def test_no_stream_flag(self):
735739 from python_agent_harness .cli import build_parser
736740
737741 parser = build_parser ()
738- off = parser .parse_args (["run" , "/tmp" , "--no-stream" ])
742+ off = parser .parse_args (["run" , "--project" , " /tmp" , "--no-stream" ])
739743 self .assertTrue (off .no_stream )
740- on = parser .parse_args (["run" , "/tmp" ])
744+ on = parser .parse_args (["run" , "--project" , " /tmp" ])
741745 self .assertFalse (on .no_stream )
742746
743747
0 commit comments