Merge pull request #794 from hroncok/nocolor
Force NO_COLOR=1 to fix test failures with Python 3.13+ REPL
diff --git a/pexpect/replwrap.py b/pexpect/replwrap.py
index 08dbd5e..c8714a2 100644
--- a/pexpect/replwrap.py
+++ b/pexpect/replwrap.py
@@ -35,7 +35,7 @@
continuation_prompt=PEXPECT_CONTINUATION_PROMPT,
extra_init_cmd=None):
if isinstance(cmd_or_spawn, basestring):
- self.child = pexpect.spawn(cmd_or_spawn, echo=False, encoding='utf-8')
+ self.child = pexpect.spawn(cmd_or_spawn, echo=False, encoding='utf-8', env={'NO_COLOR': '1'})
else:
self.child = cmd_or_spawn
if self.child.echo:
diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py
index ddafa5d..5ac782a 100644
--- a/tests/test_replwrap.py
+++ b/tests/test_replwrap.py
@@ -124,7 +124,7 @@
if platform.python_implementation() == 'PyPy':
raise unittest.SkipTest(skip_pypy)
- child = pexpect.spawn(sys.executable, echo=False, timeout=5, encoding='utf-8')
+ child = pexpect.spawn(sys.executable, echo=False, timeout=5, encoding='utf-8', env={'NO_COLOR': '1'})
# prompt_change=None should mean no prompt change
py = replwrap.REPLWrapper(child, u">>> ", prompt_change=None,
continuation_prompt=u"... ")