pytest: Cannot setup `log_format` in `setup.cfg, because of `InterpolationMissingOptionError`
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.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (14 by maintainers)
Commits related to this issue
- Moved pytest out of setup.cfg into pytest.ini. Explanation: https://github.com/pytest-dev/pytest/issues/3062 — committed to Mulugruntz/jam by deleted user 6 years ago
- Moved pytest out of setup.cfg into pytest.ini. Explanation: https://github.com/pytest-dev/pytest/issues/3062 — committed to Mulugruntz/jam by deleted user 6 years ago
- Move flake8 configuration out of tox.ini. I wish it could go in setup.cfg, but that's impossible due to the string interpolation (see https://github.com/pytest-dev/pytest/issues/3062 for a similar pr... — committed to scolby33/OCSPdash by scolby33 6 years ago
- Move pytest configuration out of setup.cfg Including the log_format directive otherwise breaks pip :( See: - https://github.com/pytest-dev/pytest/issues/3062 - https://docs.pytest.org/en/latest/refe... — committed to betagouv/zam by ronnix 5 years ago
- Move pytest configuration out of setup.cfg Including the log_format directive otherwise breaks pip :( See: - https://github.com/pytest-dev/pytest/issues/3062 - https://docs.pytest.org/en/latest/refe... — committed to betagouv/zam by ronnix 5 years ago
- Move pytest configuration out of setup.cfg Including the log_format directive otherwise breaks pip :( See: - https://github.com/pytest-dev/pytest/issues/3062 - https://docs.pytest.org/en/latest/refe... — committed to betagouv/zam by ronnix 5 years ago
- Move pytest configuration out of setup.cfg Including the log_format directive otherwise breaks pip :( See: - https://github.com/pytest-dev/pytest/issues/3062 - https://docs.pytest.org/en/latest/refe... — committed to betagouv/zam by ronnix 5 years ago
- Move pytest configuration out of setup.cfg Including the log_format directive otherwise breaks pip :( See: - https://github.com/pytest-dev/pytest/issues/3062 - https://docs.pytest.org/en/latest/refe... — committed to betagouv/zam by ronnix 5 years ago
- Move pytest configuration out of setup.cfg Including the log_format directive otherwise breaks pip :( See: - https://github.com/pytest-dev/pytest/issues/3062 - https://docs.pytest.org/en/latest/refe... — committed to betagouv/zam by ronnix 5 years ago
- Move pytest config out of setup.cfg (pytest-dev/pytest#3062) — committed to gusutabopb/aioinflux by gusutabopb 5 years ago
- Fix setup.cfg error Don't move pytest settings into setup.cfg https://github.com/pytest-dev/pytest/issues/3062 — committed to linw1995/data_extractor by linw1995 5 years ago
- Add pre-commit support and fix pre-commit check error (#32) * Add pre-commit * Fix pre-commit check error * Replace pytest.ini with setup.cfg * Remove MANIFEST.in * Fix .travis.yml error ... — committed to linw1995/data_extractor by linw1995 5 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/nark by hotoffthehamster 4 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/dob by hotoffthehamster 4 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/dob-viewer by hotoffthehamster 4 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/dob-prompt by hotoffthehamster 4 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/dob-bright by landonb 4 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/config-decorator by hotoffthehamster 4 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/human-friendly_pedantic-timedelta by hotoffthehamster 4 years ago
- DX: Work-around: Tox crashes on flake8 format setting. - Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.Interpol... — committed to landonb/pep440-version-compare-cli by landonb 4 years ago
@BeyondEvil correct