diff options
author | Jeff Quast <contact@jeffquast.com> | 2015-09-15 17:26:50 -0700 |
---|---|---|
committer | Jeff Quast <contact@jeffquast.com> | 2015-09-15 17:26:50 -0700 |
commit | 1a8bd9750d7023b32b647677874211b38a3772f6 (patch) | |
tree | 3b8821621e229cecf3e13007ae4c0dc0ea7b225f /tests/test_interact.py | |
parent | cde8e15893edd87c61acf0515fd217554d21ce51 (diff) | |
download | pexpect-allow-disable-escape-interact.tar.gz |
Allow {p}.interact(escape_character=None)allow-disable-escape-interact
For those who wish to disable the ability to escape using process
(likely, human) input until normal process termination, they may
now set the value of escape_character to None.
Some of the related docstring on escape_character was made more
brief and clear about its behaviour.
Diffstat (limited to 'tests/test_interact.py')
-rwxr-xr-x | tests/test_interact.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_interact.py b/tests/test_interact.py index e635cb0..21d083b 100755 --- a/tests/test_interact.py +++ b/tests/test_interact.py @@ -57,6 +57,18 @@ class InteractTestCase (PexpectTestCase.PexpectTestCase): assert not p.isalive() assert p.exitstatus == 0 + def test_interact_escape_None(self): + " Return only after Termination when `escape_character=None'. " + p = pexpect.spawn('{self.interact_py} --no-escape'.format(self=self), + timeout=5, env=self.env) + p.expect('<in >') + p.sendcontrol('d') + p.expect('<eof>') + p.expect_exact('Escaped interact') + p.expect(pexpect.EOF) + assert not p.isalive() + assert p.exitstatus == 0 + def test_interact_spawn_eof(self): " Ensure subprocess receives EOF and exit. " p = pexpect.spawn(self.interact_py, timeout=5, env=self.env) |