summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2015-10-04 09:47:10 +0100
committerThomas Kluyver <takowl@gmail.com>2015-10-04 09:47:10 +0100
commit8510cfaa238b21feecf3bd19e7a5b49b4d38b50d (patch)
treeb54659eee7d0ef7a0758a3add4d65aa61558e0e4
parent16ab7bcb5722c6b31dd852224c7e0d3c8a69c53b (diff)
downloadpexpect-git-8510cfaa238b21feecf3bd19e7a5b49b4d38b50d.tar.gz
Don't use deprecated spawnu in replwrap tests
-rw-r--r--pexpect/replwrap.py5
-rw-r--r--tests/test_replwrap.py4
2 files changed, 5 insertions, 4 deletions
diff --git a/pexpect/replwrap.py b/pexpect/replwrap.py
index 8d767c3..6439b35 100644
--- a/pexpect/replwrap.py
+++ b/pexpect/replwrap.py
@@ -35,7 +35,7 @@ class REPLWrapper(object):
continuation_prompt=PEXPECT_CONTINUATION_PROMPT,
extra_init_cmd=None):
if isinstance(cmd_or_spawn, basestring):
- self.child = pexpect.spawnu(cmd_or_spawn, echo=False)
+ self.child = pexpect.spawn(cmd_or_spawn, echo=False, encoding='utf-8')
else:
self.child = cmd_or_spawn
if self.child.echo:
@@ -107,6 +107,7 @@ def python(command="python"):
def bash(command="bash"):
"""Start a bash shell and return a :class:`REPLWrapper` object."""
bashrc = os.path.join(os.path.dirname(__file__), 'bashrc.sh')
- child = pexpect.spawnu(command, ['--rcfile', bashrc], echo=False)
+ child = pexpect.spawn(command, ['--rcfile', bashrc], echo=False,
+ encoding='utf-8')
return REPLWrapper(child, u'\$', u"PS1='{0}' PS2='{1}' PROMPT_COMMAND=''",
extra_init_cmd="export PAGER=cat")
diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py
index 314786b..52293fb 100644
--- a/tests/test_replwrap.py
+++ b/tests/test_replwrap.py
@@ -63,7 +63,7 @@ class REPLWrapTestCase(unittest.TestCase):
self.assertEqual(res.strip().splitlines(), ['1 2', '3 4'])
def test_existing_spawn(self):
- child = pexpect.spawnu("bash", timeout=5, echo=False)
+ child = pexpect.spawn("bash", timeout=5, echo=False, encoding='utf-8')
repl = replwrap.REPLWrapper(child, re.compile('[$#]'),
"PS1='{0}' PS2='{1}' "
"PROMPT_COMMAND=''")
@@ -86,7 +86,7 @@ class REPLWrapTestCase(unittest.TestCase):
if platform.python_implementation() == 'PyPy':
raise unittest.SkipTest(skip_pypy)
- child = pexpect.spawnu('python', echo=False, timeout=5)
+ child = pexpect.spawn('python', echo=False, timeout=5, encoding='utf-8')
# prompt_change=None should mean no prompt change
py = replwrap.REPLWrapper(child, u">>> ", prompt_change=None,
continuation_prompt=u"... ")