@@ -873,6 +873,31 @@ def test_dumb_terminal_exits_cleanly(self):
873
873
self .assertNotIn ("Exception" , output )
874
874
self .assertNotIn ("Traceback" , output )
875
875
876
+ @force_not_colorized
877
+ def test_python_basic_repl (self ):
878
+ env = os .environ .copy ()
879
+ commands = ("from test.support import initialized_with_pyrepl\n "
880
+ "initialized_with_pyrepl()\n "
881
+ "exit()\n " )
882
+
883
+ env .pop ("PYTHON_BASIC_REPL" , None )
884
+ output , exit_code = self .run_repl (commands , env = env )
885
+ if "can\' t use pyrepl" in output :
886
+ self .skipTest ("pyrepl not available" )
887
+ self .assertEqual (exit_code , 0 )
888
+ self .assertIn ("True" , output )
889
+ self .assertNotIn ("False" , output )
890
+ self .assertNotIn ("Exception" , output )
891
+ self .assertNotIn ("Traceback" , output )
892
+
893
+ env ["PYTHON_BASIC_REPL" ] = "1"
894
+ output , exit_code = self .run_repl (commands , env = env )
895
+ self .assertEqual (exit_code , 0 )
896
+ self .assertIn ("False" , output )
897
+ self .assertNotIn ("True" , output )
898
+ self .assertNotIn ("Exception" , output )
899
+ self .assertNotIn ("Traceback" , output )
900
+
876
901
def run_repl (self , repl_input : str | list [str ], env : dict | None = None ) -> tuple [str , int ]:
877
902
master_fd , slave_fd = pty .openpty ()
878
903
process = subprocess .Popen (
0 commit comments