MCPcopy Create free account
hub / github.com/pexpect/pexpect / test_socket

Method test_socket

tests/test_socket.py:156–168  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

154 exit(result)
155
156 def test_socket(self):
157 sock = socket.socket(self.af, socket.SOCK_STREAM)
158 sock.connect((self.host, self.port))
159 session = self.spawn(sock, timeout=10)
160 session.expect(self.prompt1)
161 self.assertEqual(session.before, self.motd)
162 session.send(self.enter)
163 session.expect(self.prompt2)
164 session.send(self.enter)
165 session.expect(self.prompt3)
166 session.send(self.exit)
167 session.expect(pexpect.EOF)
168 self.assertEqual(session.before, b'')
169
170 def test_socket_with_write(self):
171 sock = socket.socket(self.af, socket.SOCK_STREAM)

Callers

nothing calls this directly

Calls 3

spawnMethod · 0.95
expectMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected