Skip to content

Conversation

borntyping
Copy link

The content in log sections doesn't always include a trailing newline, so this includes one afterwards ensuring that the next section header is placed on a new line.

This is only really useful if there are multiple log sections, like in the example below. If there's already a trailing newline, this has no effect as it adds a <br> tag which doesn't change the spacing at the end of the content.

Example
import pytest


@pytest.fixture()
def logger():
    import logging

    log = logging.getLogger(__name__)
    log.info("before the test")
    return log


def test_log(logger):
    logger.info("during the test")
    raise Exception
Before
After

The content in log sections doesn't always include a trailing newline, so this includes one afterwards ensuring that the next section header is placed on a new line. If there's already a trailing newline, this has no effect as it uses `<br>`.
@BeyondEvil
Copy link
Contributor

Thank you for this @borntyping !

This has annoyed me for ever, but I've never gotten around to actually fixing it.

Copy link
Contributor

@BeyondEvil BeyondEvil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@BeyondEvil BeyondEvil merged commit c9eadb0 into pytest-dev:master Jul 9, 2019
@ssbarnea ssbarnea added the bug This issue/PR relates to a bug. label Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants