{"id":45917,"library":"pytest-logbook","title":"pytest-logbook","description":"pytest-logbook is a py.test plugin that captures Logbook log messages during test execution, making them available in test reports. The current version is 1.2.0, released with an irregular cadence.","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/pytest-dev/pytest-logbook","tags":["pytest","plugin","logbook","logging"],"install":[{"cmd":"pip install pytest-logbook","lang":"bash","label":"Install"}],"dependencies":[],"imports":[{"note":"Used to configure logging level via pytest.mark.logbook or set log_level fixture.","wrong":"","symbol":"pytest_logbook","correct":"import pytest_logbook"}],"quickstart":{"code":"# test_my_module.py\nimport logging\n\ndef test_with_logging(log_level):\n    log_level('DEBUG')\n    logger = logging.getLogger(__name__)\n    logger.debug('Debug message')\n    assert True","lang":"python","description":"Basic usage: use the log_level fixture to set the logging level for a test."},"warnings":[{"fix":"Use pytest-catchlog or the built-in caplog fixture for stdlib logging.","message":"The plugin only captures output from the 'logbook' library, not the standard 'logging' module. If your code uses stdlib logging, this plugin won't capture messages.","severity":"gotcha","affected_versions":"all"},{"fix":"Pass 'log_level' as a parameter to each test function that needs it.","message":"The log_level fixture must be requested as a test parameter; it doesn't work as a session-scoped fixture.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the log_level fixture instead of the CLI option.","message":"The '--log-level' command-line option was deprecated in version 1.2.0 in favor of using the log_level fixture.","severity":"deprecated","affected_versions":">=1.2.0"}],"env_vars":null,"search_vec":"'1.2.0':29 'avail':21 'cadenc':34 'captur':12 'current':26 'execut':18 'irregular':33 'log':14,38 'logbook':3,6,13,37 'make':19 'messag':15 'plugin':10,36 'py.test':9 'pytest':2,5,35 'pytest-logbook':1,4 'releas':30 'report':24 'test':17,23 'version':27","created_at":"2026-06-07T12:57:22.570734+00:00","updated_at":"2026-06-07T12:57:22.570734+00:00","problems":[{"fix":"pip install logbook","cause":"The plugin requires logbook to be installed.","error":"Logbook library not installed"},{"fix":"pip install pytest-logbook and rely on pytest's plugin discovery; do not import manually.","cause":"The plugin is not installed or imported directly.","error":"No module named 'pytest_logbook'"},{"fix":"Ensure the log_level fixture is used and the logger is from logbook, not stdlib.","cause":"The log_level fixture not properly set or logger not correctly configured.","error":"AttributeError: 'NoneType' object has no attribute 'info'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"http://bitbucket.org/flub/pytest-logbook","github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}