Skip to content

Document that pytest's log capturing counts toward memory limits - #200

Open
mkzung wants to merge 1 commit into
bloomberg:mainfrom
mkzung:docs/log-capture-counts-toward-limits
Open

mkzung wants to merge 1 commit into
bloomberg:mainfrom
mkzung:docs/log-capture-counts-toward-limits

Conversation

@mkzung

@mkzung mkzung commented Sep 23, 2026

Copy link
Copy Markdown

Fixes #29.

pytest keeps every log record a test emits, and those allocations count toward limit_memory. This test fails with 17.5 MiB allocated and passes with -p no:logging:

import logging

import pytest

log = logging.getLogger(__name__)


@pytest.mark.limit_memory("1 MB")
def test_many_warnings():
    for i in range(20_000):
        log.warning("message %d", i)

This adds a note saying so under limit_memory in the usage docs, with a news fragment.

Fixes bloomberg#29

Signed-off-by: mkzung <103102868+mkzung@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable the caplog fixture by default

1 participant