summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pyrepl/test_pyrepl.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-07-05 20:30:08 (GMT)
committerGitHub <noreply@github.com>2024-07-05 20:30:08 (GMT)
commit6239d41527d5977aa5d44e4b894d719bc045860e (patch)
tree9aa63097cc796dd1378587fbd098692eaca61408 /Lib/test/test_pyrepl/test_pyrepl.py
parent892e3a1b708391cb43517a141f9b9712e047b8a4 (diff)
downloadcpython-6239d41527d5977aa5d44e4b894d719bc045860e.zip
cpython-6239d41527d5977aa5d44e4b894d719bc045860e.tar.gz
cpython-6239d41527d5977aa5d44e4b894d719bc045860e.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_pyrepl/test_pyrepl.py')
-rw-r--r--Lib/test/test_pyrepl/test_pyrepl.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py
index 93c8046..7621b8a 100644
--- a/Lib/test/test_pyrepl/test_pyrepl.py
+++ b/Lib/test/test_pyrepl/test_pyrepl.py
@@ -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,