diff options
author | Jeff Quast <contact@jeffquast.com> | 2015-04-24 22:50:13 -0700 |
---|---|---|
committer | Jeff Quast <contact@jeffquast.com> | 2015-04-24 23:00:49 -0700 |
commit | 4511949f6e37a1582129cdc68e0176bf263b5b76 (patch) | |
tree | 1eb44af04aaf125553dcc80e1743141a5f67fbba | |
parent | 2d35bbafa849db7a8e483c626d2d392469b82fb6 (diff) | |
download | pexpect-git-4511949f6e37a1582129cdc68e0176bf263b5b76.tar.gz |
workaround travis-ci's strange EOF issue
-rwxr-xr-x | tests/test_interact.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/test_interact.py b/tests/test_interact.py index 06fc44a..e635cb0 100755 --- a/tests/test_interact.py +++ b/tests/test_interact.py @@ -66,9 +66,12 @@ class InteractTestCase (PexpectTestCase.PexpectTestCase): p.expect(b'<out>alpha') p.expect(b'<out>beta') p.sendeof() - p.expect_exact('<eof>') - p.expect_exact('Escaped interact') - p.expect(pexpect.EOF) + # strangely, on travis-ci, sendeof() terminates the subprocess, + # it doesn't receive ^D, just immediately throws EOF. + idx = p.expect_exact(['<eof>', pexpect.EOF]) + if idx == 0: + p.expect_exact('Escaped interact') + p.expect(pexpect.EOF) assert not p.isalive() assert p.exitstatus == 0 @@ -81,9 +84,12 @@ class InteractTestCase (PexpectTestCase.PexpectTestCase): p.expect('<out>ɑlpha') p.expect('<out>Βeta') p.sendeof() - p.expect_exact('<eof>') - p.expect_exact('Escaped interact') - p.expect(pexpect.EOF) + # strangely, on travis-ci, sendeof() terminates the subprocess, + # it doesn't receive ^D, just immediately throws EOF. + idx = p.expect_exact(['<eof>', pexpect.EOF]) + if idx == 0: + p.expect_exact('Escaped interact') + p.expect(pexpect.EOF) assert not p.isalive() assert p.exitstatus == 0 |