@@ -862,6 +862,26 @@ def test_dumb_terminal_exits_cleanly(self):
862862 self .assertNotIn ("Exception" , output )
863863 self .assertNotIn ("Traceback" , output )
864864
865+ def test_python_basic_repl (self ):
866+ env = os .environ .copy ()
867+ commands = ("from test.support import initialized_with_pyrepl\n "
868+ "initialized_with_pyrepl()\n "
869+ "exit()\n " )
870+
871+ env .pop ("PYTHON_BASIC_REPL" , None )
872+ output , exit_code = self .run_repl (commands , env = env )
873+ self .assertEqual (exit_code , 0 )
874+ self .assertIn ("True" , output )
875+ self .assertNotIn ("Exception" , output )
876+ self .assertNotIn ("Traceback" , output )
877+
878+ env ["PYTHON_BASIC_REPL" ] = "1"
879+ output , exit_code = self .run_repl (commands , env = env )
880+ self .assertEqual (exit_code , 0 )
881+ self .assertIn ("False" , output )
882+ self .assertNotIn ("Exception" , output )
883+ self .assertNotIn ("Traceback" , output )
884+
865885 def run_repl (self , repl_input : str | list [str ], env : dict | None = None ) -> tuple [str , int ]:
866886 master_fd , slave_fd = pty .openpty ()
867887 process = subprocess .Popen (
0 commit comments