From 8510cfaa238b21feecf3bd19e7a5b49b4d38b50d Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Sun, 4 Oct 2015 09:47:10 +0100 Subject: Don't use deprecated spawnu in replwrap tests --- pexpect/replwrap.py | 5 +++-- tests/test_replwrap.py | 4 ++-- 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"... ") -- cgit v1.2.1