generated from daniil-berg/boilerplate-py
End control server response with newline
This commit is contained in:
parent
28c997e0ee
commit
ee0b8c0002
@ -22,7 +22,7 @@ copyright = '2022 Daniil Fajnberg'
|
||||
author = 'Daniil Fajnberg'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = '1.1.2'
|
||||
release = '1.1.3'
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = asyncio-taskpool
|
||||
version = 1.1.2
|
||||
version = 1.1.3
|
||||
author = Daniil Fajnberg
|
||||
author_email = mail@daniil.fajnberg.de
|
||||
description = Dynamically manage pools of asyncio tasks
|
||||
|
@ -148,6 +148,7 @@ class ControlSession:
|
||||
metavar="(A command followed by '-h' or '--help' will show command-specific help.)")
|
||||
self._parser.add_class_commands(self._pool.__class__)
|
||||
self._writer.write(str(self._pool).encode())
|
||||
self._writer.write(b'\n')
|
||||
await self._writer.drain()
|
||||
|
||||
async def _parse_command(self, msg: str) -> None:
|
||||
@ -197,4 +198,5 @@ class ControlSession:
|
||||
self._response_buffer.seek(0)
|
||||
self._response_buffer.truncate()
|
||||
self._writer.write(response.encode())
|
||||
self._writer.write(b'\n')
|
||||
await self._writer.drain()
|
||||
|
@ -121,7 +121,7 @@ class ControlServerTestCase(IsolatedAsyncioTestCase):
|
||||
mock_parser_cls.assert_called_once_with(**expected_parser_kwargs)
|
||||
mock_add_subparsers.assert_called_once_with(**expected_subparsers_kwargs)
|
||||
mock_add_class_commands.assert_called_once_with(self.mock_pool.__class__)
|
||||
self.mock_writer.write.assert_called_once_with(str(self.mock_pool).encode())
|
||||
self.mock_writer.write.assert_has_calls([call(str(self.mock_pool).encode()), call(b'\n')])
|
||||
self.mock_writer.drain.assert_awaited_once_with()
|
||||
|
||||
@patch.object(session.ControlSession, '_exec_property_and_respond')
|
||||
@ -200,7 +200,7 @@ class ControlServerTestCase(IsolatedAsyncioTestCase):
|
||||
self.mock_reader.readline.assert_has_awaits([call(), call()])
|
||||
mock__parse_command.assert_awaited_once_with(msg)
|
||||
self.assertEqual('', self.session._response_buffer.getvalue())
|
||||
self.mock_writer.write.assert_called_once_with(response.encode())
|
||||
self.mock_writer.write.assert_has_calls([call(response.encode()), call(b'\n')])
|
||||
self.mock_writer.drain.assert_awaited_once_with()
|
||||
|
||||
self.mock_reader.readline.reset_mock()
|
||||
|
Loading…
Reference in New Issue
Block a user