diff options
Diffstat (limited to 'tests/test_winsize.py')
-rwxr-xr-x | tests/test_winsize.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/test_winsize.py b/tests/test_winsize.py index 384e611..f029ad3 100755 --- a/tests/test_winsize.py +++ b/tests/test_winsize.py @@ -31,23 +31,25 @@ class TestCaseWinsize(PexpectTestCase.PexpectTestCase): This makes use of an external script sigwinch_report.py. ''' p1 = pexpect.spawn('%s sigwinch_report.py' % self.PYTHONBIN) - time.sleep(10) + p1.expect('READY', timeout=10) + p1.setwinsize (11,22) - time.sleep(3) - index = p1.expect ([pexpect.TIMEOUT, b'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], timeout=30) + index = p1.expect ([pexpect.TIMEOUT, b'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], + timeout=30) if index == 0: - self.fail ("TIMEOUT -- this platform may not support sigwinch properly.\n" + str(p1)) - r = p1.match.group(1) - c = p1.match.group(2) - assert (r==b"11" and c==b"22") + self.fail("TIMEOUT -- this platform may not support sigwinch properly.\n" + str(p1)) + self.assertEqual(p1.match.group(1, 2), (b"11" ,b"22")) + self.assertEqual(p1.getwinsize(), (11, 22)) + time.sleep(1) p1.setwinsize (24,80) - index = p1.expect ([pexpect.TIMEOUT, b'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], timeout=10) + index = p1.expect ([pexpect.TIMEOUT, b'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], + timeout=10) if index == 0: self.fail ("TIMEOUT -- this platform may not support sigwinch properly.\n" + str(p1)) - r = p1.match.group(1) - c = p1.match.group(2) - assert (r==b"24" and c==b"80") + self.assertEqual(p1.match.group(1, 2), (b"24" ,b"80")) + self.assertEqual(p1.getwinsize(), (24, 80)) + p1.close() # def test_parent_resize (self): |