Skip to content

Commit

Permalink
Rename _adapter_get_write_buffer_size to _get_write_buffer_size
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Feb 1, 2019
1 parent e8950f2 commit ecc0e59
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pika/adapters/blocking_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def _flush_output(self, *waiters):
is_done = (lambda:
self._closed_result.ready or
((not self._impl._transport or
self._impl._adapter_get_write_buffer_size() == 0) and
self._impl._get_write_buffer_size() == 0) and
(not waiters or any(ready() for ready in waiters))))

# Process I/O until our completion condition is satisfied
Expand Down
2 changes: 1 addition & 1 deletion pika/adapters/select_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def connection_factory(params):
workflow=workflow,
on_done=on_done)

def _adapter_get_write_buffer_size(self):
def _get_write_buffer_size(self):
"""
:return: Current size of output data buffered by the transport
:rtype: int
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/blocking_connection_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SelectConnectionTemplate(
_channels = None
ioloop = None
_transport = None
_adapter_get_write_buffer_size = None
_get_write_buffer_size = None


class BlockingConnectionTests(unittest.TestCase):
Expand Down Expand Up @@ -121,15 +121,15 @@ def test_flush_output(self, select_connection_class_mock):
connection = blocking_connection.BlockingConnection('params')

get_buffer_size_mock = mock.Mock(
name='_adapter_get_write_buffer_size',
name='_get_write_buffer_size',
side_effect=[100, 50, 0],
spec=nbio_interface.AbstractStreamTransport.get_write_buffer_size)

transport_mock = mock.NonCallableMock(
spec_set=nbio_interface.AbstractStreamTransport)

connection._impl._transport = transport_mock
connection._impl._adapter_get_write_buffer_size = get_buffer_size_mock
connection._impl._get_write_buffer_size = get_buffer_size_mock

connection._flush_output(lambda: False, lambda: True)

Expand Down
3 changes: 0 additions & 3 deletions tests/unit/heartbeat_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ def remove_timeout(self, timeout_id):
def _adapter_emit_data(self, data):
raise NotImplementedError

def _adapter_get_write_buffer_size(self):
raise NotImplementedError

def _adapter_add_callback_threadsafe(self, callback):
raise NotImplementedError

Expand Down

0 comments on commit ecc0e59

Please sign in to comment.