-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
I would like to setup log_format
in the project-wise configuration file setup.cfg
. I do it like this:
[tool:pytest]
log_format = %(filename)s:%(lineno)d %(name)s%(levelname)s%(message)s
Given this, any invocation of some setup.py
or simply pip install -r requirements.txt
in the directory where setup.cfg
resides, gives me a error:
configparser.InterpolationMissingOptionError: Bad value substitution: option 'log_format' in section 'tool:pytest' contains an interpolation key 'filename' which is not a valid option name. Raw value: '%(filename)s:%(lineno)d %(name)s%(levelname)s%(message)s'
As far as I understand, the reason is that %-formatting is used in config files for string interpolation. It is recommended to screen %
with another %
to avoid interpolation. Well, if I do this then pytest-catchlog
stops interpreting this string as format and simply output it as is.
It looks like, pytest-catchlog
shall adopt the rules of writing setup.cfg
files. If there is another solution or workaround, please let me know.
Bug was originally posted to the pytest-catchlog
issue tracker here , but once this plugin was merged into PyTest I have to report the bug is still here.
P.S. Sorry for ignoring all the steps listed in the contributing guidelines, but this bug was reproduced and confirmed successfully in the original bug report.