31
31
except ImportError :
32
32
pty = None
33
33
34
+
35
+ clean_env = os .environ .copy ()
36
+ # cleanup from PYTHON* variables
37
+ for k in clean_env .copy ():
38
+ if k .startswith ("PYTHON" ):
39
+ clean_env .pop (k )
40
+
41
+
34
42
class TestCursorPosition (TestCase ):
35
43
def prepare_reader (self , events ):
36
44
console = FakeConsole (events )
@@ -869,7 +877,7 @@ def test_exposed_globals_in_repl(self):
869
877
self .assertTrue (case1 or case2 or case3 or case4 , output )
870
878
871
879
def test_dumb_terminal_exits_cleanly (self ):
872
- env = os . environ .copy ()
880
+ env = clean_env .copy ()
873
881
env .update ({"TERM" : "dumb" })
874
882
output , exit_code = self .run_repl ("exit()\n " , env = env )
875
883
self .assertEqual (exit_code , 0 )
@@ -879,7 +887,7 @@ def test_dumb_terminal_exits_cleanly(self):
879
887
880
888
@force_not_colorized
881
889
def test_python_basic_repl (self ):
882
- env = os . environ .copy ()
890
+ env = clean_env .copy ()
883
891
commands = ("from test.support import initialized_with_pyrepl\n "
884
892
"initialized_with_pyrepl()\n "
885
893
"exit()\n " )
@@ -908,7 +916,7 @@ def test_not_wiping_history_file(self):
908
916
909
917
hfile = tempfile .NamedTemporaryFile (delete = False )
910
918
self .addCleanup (unlink , hfile .name )
911
- env = os . environ .copy ()
919
+ env = clean_env .copy ()
912
920
env ["PYTHON_HISTORY" ] = hfile .name
913
921
commands = "123\n spam\n exit()\n "
914
922
0 commit comments