pytest-logging
raw JSON → 2015.11.4 verified Fri May 01 auth: no python maintenance
Configures logging for pytest and allows tweaking the log level via command-line flags. Current version is 2015.11.4. The package has been in maintenance mode for years and is largely superseded by built-in pytest logging since pytest 3.3+.
pip install pytest-logging Common errors
error ModuleNotFoundError: No module named 'pytest_logging' ↓
cause Old package expects installed plugin; sometimes missing from environment.
fix
pip install pytest-logging and ensure it's in the test environment.
error AttributeError: module 'logging' has no attribute 'addLevelName' ↓
cause In rare cases, this error appears due to incompatible Python version (log level manipulation).
fix
Update Python to 2.7+ or use built-in logging.
Warnings
deprecated pytest-logging is effectively deprecated; built-in pytest logging (pytest >=3.3) offers richer functionality. Consider using pytest's -o log_cli=true or log_cli_level. ↓
fix Remove pytest-logging and use pytest's built-in logging configuration.
gotcha The --log-level flag conflicts with pytest's built-in --log-cli-level; both may interfere. ↓
fix Use only one mechanism to avoid confusion.
Imports
- pytest_logging
import pytest_logging
Quickstart
# pytest.ini or setup.cfg
[pytest]
log_cli = true
log_level = DEBUG
# Then run tests with: pytest -s --log-level=DEBUG