@@ -384,45 +384,6 @@ def test_asyncio_repl_is_ok(self):
384384
385385 self .assertEqual (exit_code , 0 , "" .join (output ))
386386
387- def test_pythonstartup_success (self ):
388- # errors based on https://github.com/python/cpython/issues/137576
389- # case 1: error in user input, but PYTHONSTARTUP is fine
390- startup_code = "print('notice from pythonstartup')"
391- startup_env = self .enterContext (new_pythonstartup_env (code = startup_code ))
392-
393- p = spawn_repl ("-q" , env = os .environ | startup_env , isolated = False )
394- p .stdin .write ("1/0" )
395- output = kill_python (p )
396- self .assertStartsWith (output , 'notice from pythonstartup' )
397- expected = dedent ("""\
398- Traceback (most recent call last):
399- File "<stdin>", line 1, in <module>
400- 1/0
401- ~^~
402- ZeroDivisionError: division by zero
403- """ )
404- self .assertIn (expected , output )
405-
406- def test_pythonstartup_failure (self ):
407- # case 2: error in PYTHONSTARTUP triggered by user input
408- startup_code = "def foo():\n 1/0\n "
409- startup_env = self .enterContext (new_pythonstartup_env (code = startup_code ))
410-
411- p = spawn_repl ("-q" , env = os .environ | startup_env , isolated = False )
412- p .stdin .write ("foo()" )
413- output = kill_python (p )
414- expected = dedent (f"""\
415- Traceback (most recent call last):
416- File "<stdin>", line 1, in <module>
417- foo()
418- ~~~^^
419- File "{ startup_env ['PYTHONSTARTUP' ]} ", line 2, in foo
420- 1/0
421- ~^~
422- ZeroDivisionError: division by zero
423- """ )
424- self .assertIn (expected , output )
425-
426387
427388@support .force_not_colorized_test_class
428389class TestInteractiveModeSyntaxErrors (unittest .TestCase ):
0 commit comments