diff options
author | dluyer <53582923+dluyer@users.noreply.github.com> | 2019-08-07 09:33:45 -0700 |
---|---|---|
committer | Thomas Kluyver <thomas@kluyver.me.uk> | 2019-08-07 17:33:45 +0100 |
commit | ecd3a19ee16723170f6ba583c92f0a0c51b02115 (patch) | |
tree | 14b8328dae966bebaeb4a525ee3a834379939013 /tests/test_ctrl_chars.py | |
parent | 6a4fc7c3e54217d5d90956d51829beac0f475010 (diff) | |
download | pexpect-git-ecd3a19ee16723170f6ba583c92f0a0c51b02115.tar.gz |
Always use self.PYTHONBIN not 'python' or sys.executable in tests (#580)
* s/sys.executable/self.PYTHONBIN/
* s/sys.executable/self.PYTHONBIN/
* Update test_isalive.py
* s/sys.executable/self.PYTHONBIN/
* s/sys.executable/self.PYTHONBIN/
* Support cases where pythonbin != sys.executable
* Support cases where pythonbin != sys.executable
* Fix raw use of 'python' to use self.PYTHONBIN
* Fix test_pxssh.py when PYTHONBIN != 'python'
The fake 'ssh' will be started via #!/usr/bin/env python, when it may need to use sys.executable or some other self.PYTHONBIN.
* Remove unnecessary changes from pull request.
* Remove unnecessary changes from pull request.
Diffstat (limited to 'tests/test_ctrl_chars.py')
-rwxr-xr-x | tests/test_ctrl_chars.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_ctrl_chars.py b/tests/test_ctrl_chars.py index 10d03db..032027c 100755 --- a/tests/test_ctrl_chars.py +++ b/tests/test_ctrl_chars.py @@ -36,11 +36,14 @@ else: byte = chr class TestCtrlChars(PexpectTestCase.PexpectTestCase): + def setUp(self): + super(TestCtrlChars, self).setUp() + self.getch_cmd = self.PYTHONBIN + ' getch.py' def test_control_chars(self): '''This tests that we can send all 256 8-bit characters to a child process.''' - child = pexpect.spawn('python getch.py', echo=False, timeout=5) + child = pexpect.spawn(self.getch_cmd, echo=False, timeout=5) child.expect('READY') for i in range(1, 256): child.send(byte(i)) @@ -54,7 +57,7 @@ class TestCtrlChars(PexpectTestCase.PexpectTestCase): assert child.exitstatus == 0 def test_sendintr (self): - child = pexpect.spawn('python getch.py', echo=False, timeout=5) + child = pexpect.spawn(self.getch_cmd, echo=False, timeout=5) child.expect('READY') child.sendintr() child.expect(str(ord(ptyprocess._INTR)) + '<STOP>') @@ -66,7 +69,7 @@ class TestCtrlChars(PexpectTestCase.PexpectTestCase): assert child.exitstatus == 0 def test_sendeof(self): - child = pexpect.spawn('python getch.py', echo=False, timeout=5) + child = pexpect.spawn(self.getch_cmd, echo=False, timeout=5) child.expect('READY') child.sendeof() child.expect(str(ord(ptyprocess._EOF)) + '<STOP>') @@ -80,14 +83,14 @@ class TestCtrlChars(PexpectTestCase.PexpectTestCase): def test_bad_sendcontrol_chars (self): '''This tests that sendcontrol will return 0 for an unknown char. ''' - child = pexpect.spawn('python getch.py', echo=False, timeout=5) + child = pexpect.spawn(self.getch_cmd, echo=False, timeout=5) child.expect('READY') assert 0 == child.sendcontrol('1') def test_sendcontrol(self): '''This tests that we can send all special control codes by name. ''' - child = pexpect.spawn('python getch.py', echo=False, timeout=5) + child = pexpect.spawn(self.getch_cmd, echo=False, timeout=5) child.expect('READY') for ctrl in 'abcdefghijklmnopqrstuvwxyz': assert child.sendcontrol(ctrl) == 1 |