RSS Amplifier

Rida Ayed · Aug 7, 2025

Beware of emacs pytest runner defaults

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

Emacs provides an incredible python developer experience. One of it many features is the ability to run pytest. However, I spent a reasonable amount of time, figuring out why M-x python-test-one was ignoring my pytest log level settings in pyproject.toml . Whatever I set in pyproject.toml, M-x python-test-one was printing out any level e.g. logger.INFO("do not show in test") pyproject.toml [tool .…

Emacs provides an incredible python developer experience.
One of it many features is the ability to run pytest.
However, I spent a reasonable amount of time, figuring out why M-x python-test-one was ignoring my pytest log level settings in pyproject.toml.
Whatever I set in pyproject.toml, M-x python-test-one was printing out any level e.g. logger.INFO("do not show in test")

pyproject.toml
[tool.pytest.ini_options]
log_cli_level = "Error"

The solution was to remove the -s flag from pytest-cmd-flags “-x -s”.
Add this line to your init.el:

init.el
'(pytest-cmd-flags "-x")

Now your pytest buffer shows the log at it’s appropriate level.

Read on /posts/beware-emacs-pytest-runner-defaults/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.