@@ -63,6 +63,8 @@ def test_verbose(self):
6363 rc , out , err = assert_python_ok ('-vv' )
6464 self .assertNotIn (b'stack overflow' , err )
6565
66+ @unittest .skipIf (interpreter_requires_environment (),
67+ 'Cannot run -E tests when PYTHON env vars are required.' )
6668 def test_xoptions (self ):
6769 def get_xoptions (* args ):
6870 # use subprocess module directly because test.support.script_helper adds
@@ -278,11 +280,7 @@ def test_empty_PYTHONPATH_issue16309(self):
278280
279281 def test_displayhook_unencodable (self ):
280282 for encoding in ('ascii' , 'latin-1' , 'utf-8' ):
281- # We are testing a PYTHON environment variable here, so we can't
282- # use -E, -I, or script_helper (which uses them). So instead we do
283- # poor-man's isolation by deleting the PYTHON vars from env.
284- env = {key :value for (key ,value ) in os .environ .copy ().items ()
285- if not key .startswith ('PYTHON' )}
283+ env = os .environ .copy ()
286284 env ['PYTHONIOENCODING' ] = encoding
287285 p = subprocess .Popen (
288286 [sys .executable , '-i' ],
@@ -704,6 +702,8 @@ def test_pythondevmode_env(self):
704702 self .assertEqual (proc .returncode , 0 , proc )
705703
706704
705+ @unittest .skipIf (interpreter_requires_environment (),
706+ 'Cannot run -I tests when PYTHON env vars are required.' )
707707class IgnoreEnvironmentTest (unittest .TestCase ):
708708
709709 def run_ignoring_vars (self , predicate , ** env_vars ):
0 commit comments