diff options
Diffstat (limited to 'tests/test_socket.py')
-rw-r--r-- | tests/test_socket.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/test_socket.py b/tests/test_socket.py index 56d69c7..21648f4 100644 --- a/tests/test_socket.py +++ b/tests/test_socket.py @@ -225,7 +225,7 @@ class ExpectTestCase(PexpectTestCase.PexpectTestCase): session.expect(pexpect.EOF) self.assertEqual(session.before, b'') - def test_fd_isalive (self): + def test_fd_isalive(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) session = fdpexpect.fdspawn(sock.fileno(), timeout=10) @@ -233,13 +233,28 @@ class ExpectTestCase(PexpectTestCase.PexpectTestCase): sock.close() assert not session.isalive(), "Should not be alive after close()" - def test_fd_isatty (self): + def test_fd_isalive_poll(self): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.connect((self.host, self.port)) + session = fdpexpect.fdspawn(sock.fileno(), timeout=10, use_poll=True) + assert session.isalive() + sock.close() + assert not session.isalive(), "Should not be alive after close()" + + def test_fd_isatty(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) session = fdpexpect.fdspawn(sock.fileno(), timeout=10) assert not session.isatty() session.close() + def test_fd_isatty_poll(self): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.connect((self.host, self.port)) + session = fdpexpect.fdspawn(sock.fileno(), timeout=10, use_poll=True) + assert not session.isatty() + session.close() + def test_fileobj(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) |