gh-121359: Run test_pyrepl in isolated mode (#121414)

run_repl() now pass the -I option (isolated mode) to Python if the
'env' parameter is not set.
This commit is contained in:
Victor Stinner 2024-07-05 22:30:08 +02:00 committed by GitHub
parent 892e3a1b70
commit 6239d41527
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -927,8 +927,11 @@ class TestMain(TestCase):
def run_repl(self, repl_input: str | list[str], env: dict | None = None) -> tuple[str, int]:
master_fd, slave_fd = pty.openpty()
cmd = [sys.executable, "-i", "-u"]
if env is None:
cmd.append("-I")
process = subprocess.Popen(
[sys.executable, "-i", "-u"],
cmd,
stdin=slave_fd,
stdout=slave_fd,
stderr=slave_fd,