brought unittest coverage up to 100% on control modules

This commit is contained in:
2022-03-13 15:44:53 +01:00
parent 9fde231250
commit 6f082288d8
6 changed files with 113 additions and 5 deletions

View File

@ -27,7 +27,7 @@ from inspect import isfunction, signature
from typing import Callable, Optional, Union, TYPE_CHECKING
from ..constants import CLIENT_INFO, CMD, CMD_OK, SESSION_MSG_BYTES, STREAM_WRITER
from ..exceptions import HelpRequested
from ..exceptions import CommandError, HelpRequested
from ..helpers import return_or_exception
from ..pool import TaskPool, SimpleTaskPool
from .parser import ControlParser
@ -163,6 +163,8 @@ class ControlSession:
await self._exec_method_and_respond(command, **kwargs)
elif isinstance(command, property):
await self._exec_property_and_respond(command, **kwargs)
else:
self._writer.write(str(CommandError(f"Unknown command object: {command}")).encode())
async def listen(self) -> None:
"""

View File

@ -65,3 +65,7 @@ class ServerException(Exception):
class HelpRequested(ServerException):
pass
class CommandError(ServerException):
pass