diff options
author | Thomas Kluyver <takowl@gmail.com> | 2013-09-25 17:51:33 -0700 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2013-09-25 17:51:33 -0700 |
commit | 9eb6df99667b23fb503cff5d454604ffefeb6cbe (patch) | |
tree | e24ee1f1eb42ad24351b51422f295c2764f095bd /tests | |
parent | 4c19cc491fa2ad0ee1cad29078411e0b05a52e28 (diff) | |
download | pexpect-git-9eb6df99667b23fb503cff5d454604ffefeb6cbe.tar.gz |
Fix interact_unicode test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/interact_unicode.py | 2 | ||||
-rwxr-xr-x | tests/test_ctrl_chars.py | 3 | ||||
-rwxr-xr-x | tests/test_interact.py | 28 |
3 files changed, 21 insertions, 12 deletions
diff --git a/tests/interact_unicode.py b/tests/interact_unicode.py index 80276cb..2cd1bbb 100644 --- a/tests/interact_unicode.py +++ b/tests/interact_unicode.py @@ -5,7 +5,7 @@ Just like interact.py, but using spawnu instead of spawn import pexpect def main(): - p = pexpect.spawn('cat') + p = pexpect.spawnu('cat') p.interact() if __name__ == '__main__': diff --git a/tests/test_ctrl_chars.py b/tests/test_ctrl_chars.py index 8e55284..4d632f7 100755 --- a/tests/test_ctrl_chars.py +++ b/tests/test_ctrl_chars.py @@ -18,6 +18,8 @@ PEXPECT LICENSE OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ''' +from __future__ import print_function + import pexpect import unittest import PexpectTestCase @@ -76,6 +78,7 @@ class TestCtrlChars(PexpectTestCase.PexpectTestCase): child = pexpect.spawn('python getch.py') child.delaybeforesend = 0.05 for ctrl in 'abcdefghijklmnopqrstuvwxyz': + print(ctrl, end='') assert child.sendcontrol(ctrl) == 1 # Strange: on travis-ci, getch.py actually displays ^A, not '1' !? val = ord(ctrl) - (ord('a') - 1) diff --git a/tests/test_interact.py b/tests/test_interact.py index 5d071d5..3288b29 100755 --- a/tests/test_interact.py +++ b/tests/test_interact.py @@ -19,6 +19,8 @@ PEXPECT LICENSE OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ''' +from __future__ import print_function + import pexpect import unittest import PexpectTestCase @@ -41,17 +43,21 @@ class InteractTestCase (PexpectTestCase.PexpectTestCase): def test_interact_unicode (self): p = pexpect.spawnu('%s interact_unicode.py' % (self.PYTHONBIN,)) - p.sendline (u'Hello') - p.sendline (u'theré') - p.sendline (u'Mr. Pyþon') - p.expect (u'Hello') - p.expect (u'theré') - p.expect (u'Mr. Pyþon') - assert p.isalive() - p.sendeof () - p.expect (pexpect.EOF) - assert not p.isalive() - assert p.exitstatus == 0, (p.exitstatus, p.before) + try: + p.sendline (u'Hello') + p.sendline (u'theré') + p.sendline (u'Mr. Pyþon') + p.expect (u'Hello') + p.expect (u'theré') + p.expect (u'Mr. Pyþon') + assert p.isalive() + p.sendeof () + p.expect (pexpect.EOF) + assert not p.isalive() + assert p.exitstatus == 0, (p.exitstatus, p.before) + except: + print(p.before) + raise if __name__ == '__main__': |