@@ -862,6 +862,31 @@ def test_dumb_terminal_exits_cleanly(self):
862862 self .assertNotIn ("Exception" , output )
863863 self .assertNotIn ("Traceback" , output )
864864
865+ @force_not_colorized
866+ def test_python_basic_repl (self ):
867+ env = os .environ .copy ()
868+ commands = ("from test.support import initialized_with_pyrepl\n "
869+ "initialized_with_pyrepl()\n "
870+ "exit()\n " )
871+
872+ env .pop ("PYTHON_BASIC_REPL" , None )
873+ output , exit_code = self .run_repl (commands , env = env )
874+ if "can\' t use pyrepl" in output :
875+ self .skipTest ("pyrepl not available" )
876+ self .assertEqual (exit_code , 0 )
877+ self .assertIn ("True" , output )
878+ self .assertNotIn ("False" , output )
879+ self .assertNotIn ("Exception" , output )
880+ self .assertNotIn ("Traceback" , output )
881+
882+ env ["PYTHON_BASIC_REPL" ] = "1"
883+ output , exit_code = self .run_repl (commands , env = env )
884+ self .assertEqual (exit_code , 0 )
885+ self .assertIn ("False" , output )
886+ self .assertNotIn ("True" , output )
887+ self .assertNotIn ("Exception" , output )
888+ self .assertNotIn ("Traceback" , output )
889+
865890 def run_repl (self , repl_input : str | list [str ], env : dict | None = None ) -> tuple [str , int ]:
866891 master_fd , slave_fd = pty .openpty ()
867892 process = subprocess .Popen (
0 commit comments