Unverified Commit e992107e authored by mathieui's avatar mathieui

I give up

on getting Link Mauve to ever run tests
parent ce729114
...@@ -56,7 +56,7 @@ class LogMessage(LogItem): ...@@ -56,7 +56,7 @@ class LogMessage(LogItem):
self.nick = nick self.nick = nick
def _parse_log_line(msg: str) -> Optional[LogItem]: def parse_log_line(msg: str) -> Optional[LogItem]:
match = re.match(MESSAGE_LOG_RE, msg) match = re.match(MESSAGE_LOG_RE, msg)
if match: if match:
return LogMessage(*match.groups()) return LogMessage(*match.groups())
...@@ -176,7 +176,7 @@ class Logger: ...@@ -176,7 +176,7 @@ class Logger:
filename, filename,
exc_info=True) exc_info=True)
return None return None
return _parse_log_lines(lines) return parse_log_lines(lines)
def log_message(self, def log_message(self,
jid: str, jid: str,
...@@ -193,7 +193,7 @@ class Logger: ...@@ -193,7 +193,7 @@ class Logger:
""" """
if not config.get_by_tabname('use_log', jid): if not config.get_by_tabname('use_log', jid):
return True return True
logged_msg = _build_log_message(nick, msg, date=date, typ=typ) logged_msg = build_log_message(nick, msg, date=date, typ=typ)
if not logged_msg: if not logged_msg:
return True return True
if jid in self._fds.keys(): if jid in self._fds.keys():
...@@ -260,10 +260,10 @@ class Logger: ...@@ -260,10 +260,10 @@ class Logger:
return True return True
def _build_log_message(nick: str, def build_log_message(nick: str,
msg: str, msg: str,
date: Optional[datetime] = None, date: Optional[datetime] = None,
typ: int = 1) -> str: typ: int = 1) -> str:
""" """
Create a log message from a nick, a message, optionally a date and type Create a log message from a nick, a message, optionally a date and type
message types: message types:
...@@ -306,7 +306,7 @@ def _get_lines_from_fd(fd: IO[Any], nb: int = 10) -> List[str]: ...@@ -306,7 +306,7 @@ def _get_lines_from_fd(fd: IO[Any], nb: int = 10) -> List[str]:
return lines return lines
def _parse_log_lines(lines: List[str]) -> List[Dict[str, Any]]: def parse_log_lines(lines: List[str]) -> List[Dict[str, Any]]:
""" """
Parse raw log lines into poezio log objects Parse raw log lines into poezio log objects
""" """
...@@ -320,7 +320,7 @@ def _parse_log_lines(lines: List[str]) -> List[Dict[str, Any]]: ...@@ -320,7 +320,7 @@ def _parse_log_lines(lines: List[str]) -> List[Dict[str, Any]]:
idx += 1 idx += 1
log.debug('fail?') log.debug('fail?')
continue continue
log_item = _parse_log_line(lines[idx]) log_item = parse_log_line(lines[idx])
idx += 1 idx += 1
if not isinstance(log_item, LogItem): if not isinstance(log_item, LogItem):
log.debug('wrong log format? %s', log_item) log.debug('wrong log format? %s', log_item)
......
...@@ -15,13 +15,19 @@ config.config = ConfigShim() ...@@ -15,13 +15,19 @@ config.config = ConfigShim()
from poezio.windows import Input from poezio.windows import Input
class SubInput(Input):
def resize(self, *args, **kwargs):
pass
def rewrite_text(self, *args, **kwargs):
pass
def refresh(self, *args, **kwargs):
pass
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def input_obj(): def input_obj():
obj = Input() obj = SubInput()
obj.reset_completion() obj.reset_completion()
obj.resize = lambda: None
obj.rewrite_text = lambda: None
obj.refresh = lambda: None
return obj return obj
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
......
...@@ -9,11 +9,13 @@ config.config = ConfigShim() ...@@ -9,11 +9,13 @@ config.config = ConfigShim()
from poezio.windows import Input, HistoryInput, MessageInput from poezio.windows import Input, HistoryInput, MessageInput
class SubInput(Input):
def rewrite_text(self, *args, **kwargs):
return None
@pytest.fixture @pytest.fixture
def input(): def input():
input = Input() return SubInput()
input.rewrite_text = lambda: None
return input
class TestInput(object): class TestInput(object):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment