Not really sure what close=True means in a makefile call, but apparently some versions of Python don't like it. Removed the file objects entirely to sidestep the issue.
This commit is contained in:
@@ -103,11 +103,8 @@ class TestWebSocket(_TestBase):
|
|||||||
sock = eventlet.connect(
|
sock = eventlet.connect(
|
||||||
('localhost', self.port))
|
('localhost', self.port))
|
||||||
|
|
||||||
fd = sock.makefile('rw', close=True)
|
sock.sendall('\r\n'.join(connect) + '\r\n\r\n')
|
||||||
fd.write('\r\n'.join(connect) + '\r\n\r\n')
|
|
||||||
fd.flush()
|
|
||||||
result = sock.recv(1024)
|
result = sock.recv(1024)
|
||||||
fd.close()
|
|
||||||
## The server responds the correct Websocket handshake
|
## The server responds the correct Websocket handshake
|
||||||
self.assertEqual(result,
|
self.assertEqual(result,
|
||||||
'\r\n'.join(['HTTP/1.1 101 Web Socket Protocol Handshake',
|
'\r\n'.join(['HTTP/1.1 101 Web Socket Protocol Handshake',
|
||||||
@@ -128,24 +125,17 @@ class TestWebSocket(_TestBase):
|
|||||||
sock = eventlet.connect(
|
sock = eventlet.connect(
|
||||||
('localhost', self.port))
|
('localhost', self.port))
|
||||||
|
|
||||||
fd = sock.makefile('rw', close=True)
|
sock.sendall('\r\n'.join(connect) + '\r\n\r\n')
|
||||||
fd.write('\r\n'.join(connect) + '\r\n\r\n')
|
|
||||||
fd.flush()
|
|
||||||
first_resp = sock.recv(1024)
|
first_resp = sock.recv(1024)
|
||||||
fd.write('\x00hello\xFF')
|
sock.sendall('\x00hello\xFF')
|
||||||
fd.flush()
|
|
||||||
result = sock.recv(1024)
|
result = sock.recv(1024)
|
||||||
self.assertEqual(result, '\x00hello\xff')
|
self.assertEqual(result, '\x00hello\xff')
|
||||||
fd.write('\x00start')
|
sock.sendall('\x00start')
|
||||||
fd.flush()
|
eventlet.sleep(0.001)
|
||||||
fd.write(' end\xff')
|
sock.sendall(' end\xff')
|
||||||
fd.flush()
|
|
||||||
result = sock.recv(1024)
|
result = sock.recv(1024)
|
||||||
self.assertEqual(result, '\x00start end\xff')
|
self.assertEqual(result, '\x00start end\xff')
|
||||||
fd.write('')
|
sock.close()
|
||||||
fd.flush()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_getting_messages_from_websocket(self):
|
def test_getting_messages_from_websocket(self):
|
||||||
connect = [
|
connect = [
|
||||||
@@ -159,9 +149,7 @@ class TestWebSocket(_TestBase):
|
|||||||
sock = eventlet.connect(
|
sock = eventlet.connect(
|
||||||
('localhost', self.port))
|
('localhost', self.port))
|
||||||
|
|
||||||
fd = sock.makefile('rw', close=True)
|
sock.sendall('\r\n'.join(connect) + '\r\n\r\n')
|
||||||
fd.write('\r\n'.join(connect) + '\r\n\r\n')
|
|
||||||
fd.flush()
|
|
||||||
resp = sock.recv(1024)
|
resp = sock.recv(1024)
|
||||||
headers, result = resp.split('\r\n\r\n')
|
headers, result = resp.split('\r\n\r\n')
|
||||||
msgs = [result.strip('\x00\xff')]
|
msgs = [result.strip('\x00\xff')]
|
||||||
|
Reference in New Issue
Block a user