aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_pyrepl
diff options
context:
space:
mode:
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>2025-01-21 18:10:08 +0200
committerGitHub <noreply@github.com>2025-01-21 16:10:08 +0000
commit05d12eecbde1ace39826320cadf8e673d709b229 (patch)
tree2e767c71374e498d1f9759e2ba60177152b396d0 /Lib/test/test_pyrepl
parent13475e0a5a317fa61f302f030b0effcb021873d6 (diff)
downloadcpython-05d12eecbde1ace39826320cadf8e673d709b229.tar.gz
cpython-05d12eecbde1ace39826320cadf8e673d709b229.zip
gh-127873: Only check `sys.flags.ignore_environment` for `PYTHON*` env vars (#127877)
Diffstat (limited to 'Lib/test/test_pyrepl')
-rw-r--r--Lib/test/test_pyrepl/support.py10
-rw-r--r--Lib/test/test_pyrepl/test_pyrepl.py3
2 files changed, 1 insertions, 12 deletions
diff --git a/Lib/test/test_pyrepl/support.py b/Lib/test/test_pyrepl/support.py
index 672d4896c92..45e3bf758f1 100644
--- a/Lib/test/test_pyrepl/support.py
+++ b/Lib/test/test_pyrepl/support.py
@@ -101,16 +101,6 @@ handle_events_narrow_console = partial(
)
-def make_clean_env() -> dict[str, str]:
- clean_env = os.environ.copy()
- for k in clean_env.copy():
- if k.startswith("PYTHON"):
- clean_env.pop(k)
- clean_env.pop("FORCE_COLOR", None)
- clean_env.pop("NO_COLOR", None)
- return clean_env
-
-
class FakeConsole(Console):
def __init__(self, events, encoding="utf-8") -> None:
self.events = iter(events)
diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py
index f29a7ffbd7c..bbe19612437 100644
--- a/Lib/test/test_pyrepl/test_pyrepl.py
+++ b/Lib/test/test_pyrepl/test_pyrepl.py
@@ -10,7 +10,7 @@ import sys
import tempfile
from unittest import TestCase, skipUnless, skipIf
from unittest.mock import patch
-from test.support import force_not_colorized
+from test.support import force_not_colorized, make_clean_env
from test.support import SHORT_TIMEOUT
from test.support.import_helper import import_module
from test.support.os_helper import unlink
@@ -23,7 +23,6 @@ from .support import (
multiline_input,
code_to_events,
clean_screen,
- make_clean_env,
)
from _pyrepl.console import Event
from _pyrepl.readline import (ReadlineAlikeReader, ReadlineConfig,