Skip some tests that require a subinterpreter launched with -E or -I when the

interpreter under test is being run in an environment that requires the use of
environment variables such as PYTHONHOME in order to function at all.

Adds a private test.script_helper._interpreter_requires_environment() function
to be used with @unittest.skipIf on stdlib test methods requiring this.
This commit is contained in:
Gregory P. Smith 2015-02-04 00:59:40 -08:00
parent 17d87f8ae4
commit b9a3dd9dfb
4 changed files with 82 additions and 2 deletions

View file

@ -8,6 +8,7 @@ import shutil
import sys
import subprocess
import tempfile
from test import script_helper
from test.script_helper import (spawn_python, kill_python, assert_python_ok,
assert_python_failure)
@ -439,7 +440,8 @@ class CmdLineTest(unittest.TestCase):
self.assertEqual(err.splitlines().count(b'Unknown option: -a'), 1)
self.assertEqual(b'', out)
@unittest.skipIf(script_helper._interpreter_requires_environment(),
'Cannot run -I tests when PYTHON env vars are required.')
def test_isolatedmode(self):
self.verify_valid_flag('-I')
self.verify_valid_flag('-IEs')