Description
In dvc we can use logger.info as
logger.info("{} in str.format()", "log")
because of the custom formatter
but caplog uses default LogRecord.getMessage()
if self.args:
msg = msg % self.args
and fails in tests on getting caplog.messages
Steps to reproduce
Create a file with content
def test_caplog(caplog):
import logging
logger = logging.getLogger()
with caplog.at_level(logging.INFO):
logger.info("This shouldn't fail {}", 1)
assert len(caplog.messages) == 1
Run it
Produces an error like
test_caplog.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.pyenv/versions/3.7.6/envs/dvc/lib/python3.7/site-packages/_pytest/logging.py:387: in messages
return [r.getMessage() for r in self.records]
../../../.pyenv/versions/3.7.6/envs/dvc/lib/python3.7/site-packages/_pytest/logging.py:387: in <listcomp>
return [r.getMessage() for r in self.records]
....
> msg = msg % self.args
E TypeError: not all arguments converted during string formatting
../../../.pyenv/versions/3.7.6/lib/python3.7/logging/__init__.py:369: TypeError
Info
$ dvc --version
0.86.2+002dd8.mod
Description
In dvc we can use
logger.infoasbecause of the custom formatter
but caplog uses default LogRecord.getMessage()
and fails in tests on getting
caplog.messagesSteps to reproduce
Create a file with content
Run it
Produces an error like
Info