def test_colored_captured_log(pytester: Pytester) -> None:
    """Test that the level names of captured log messages of a failing test
    are colored."""
    pytester.makepyfile(
        """
        import logging

        logger = logging.getLogger(__name__)

        def test_foo():
            logger.info('text going to logger from call')
            assert False
        """
    )
    result = pytester.runpytest("--log-level=INFO", "--color=yes")
    assert result.ret == 1
    result.stdout.fnmatch_lines(
        [
            "*-- Captured log call --*",
            "\x1b[32mINFO    \x1b[0m*text going to logger from call",
        ]
    )
Test that the level names of captured log messages of a failing test
    are colored.
testing/logging/test_reporting.py