mirror of https://github.com/docker/docker-py.git
Rename next_packet_size to next_frame_size
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
456bfa1c1d
commit
9fb2caecb9
|
@ -41,7 +41,7 @@ def read_data(socket, n):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def next_packet_size(socket):
|
def next_frame_size(socket):
|
||||||
"""
|
"""
|
||||||
Returns the size of the next frame of data waiting to be read from socket,
|
Returns the size of the next frame of data waiting to be read from socket,
|
||||||
according to the protocol defined here:
|
according to the protocol defined here:
|
||||||
|
@ -61,7 +61,7 @@ def read_iter(socket):
|
||||||
"""
|
"""
|
||||||
Returns a generator of frames read from socket
|
Returns a generator of frames read from socket
|
||||||
"""
|
"""
|
||||||
n = next_packet_size(socket)
|
n = next_frame_size(socket)
|
||||||
while n > 0:
|
while n > 0:
|
||||||
yield read_socket(socket, n)
|
yield read_socket(socket, n)
|
||||||
n = next_packet_size(socket)
|
n = next_frame_size(socket)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import signal
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import docker
|
import docker
|
||||||
from docker.utils.socket import next_packet_size
|
from docker.utils.socket import next_frame_size
|
||||||
from docker.utils.socket import read_data
|
from docker.utils.socket import read_data
|
||||||
import pytest
|
import pytest
|
||||||
import six
|
import six
|
||||||
|
@ -1027,7 +1027,7 @@ class AttachContainerTest(helpers.BaseTestCase):
|
||||||
|
|
||||||
self.client.start(ident)
|
self.client.start(ident)
|
||||||
|
|
||||||
next_size = next_packet_size(pty_stdout)
|
next_size = next_frame_size(pty_stdout)
|
||||||
self.assertEqual(next_size, len(line))
|
self.assertEqual(next_size, len(line))
|
||||||
data = read_data(pty_stdout, next_size)
|
data = read_data(pty_stdout, next_size)
|
||||||
self.assertEqual(data.decode('utf-8'), line)
|
self.assertEqual(data.decode('utf-8'), line)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from docker.utils.socket import next_packet_size
|
from docker.utils.socket import next_frame_size
|
||||||
from docker.utils.socket import read_data
|
from docker.utils.socket import read_data
|
||||||
|
|
||||||
from .. import helpers
|
from .. import helpers
|
||||||
|
@ -110,7 +110,7 @@ class ExecTest(helpers.BaseTestCase):
|
||||||
socket = self.client.exec_start(exec_id, socket=True)
|
socket = self.client.exec_start(exec_id, socket=True)
|
||||||
self.addCleanup(socket.close)
|
self.addCleanup(socket.close)
|
||||||
|
|
||||||
next_size = next_packet_size(socket)
|
next_size = next_frame_size(socket)
|
||||||
self.assertEqual(next_size, len(line))
|
self.assertEqual(next_size, len(line))
|
||||||
data = read_data(socket, next_size)
|
data = read_data(socket, next_size)
|
||||||
self.assertEqual(data.decode('utf-8'), line)
|
self.assertEqual(data.decode('utf-8'), line)
|
||||||
|
|
Loading…
Reference in New Issue