I have a simple test:
import logging
LOGGER = logging.getLogger(__name__)
def test():
a = 888
LOGGER.info(">>>>>> Test1 <<<<<<<<<<<<< %s", a)
assert False
I configuted pytest so it is logging at info level.
See pyproject.toml:
[tool.pytest.ini_options]
log_cli_level="INFO"
When I execute the test with pytest tests it shows this:
tests/test_log.py F [100%]
=================================================================== FAILURES ====================================================================
_____________________________________________________________________ test ______________________________________________________________________
def test():
a = 888
LOGGER.info(">>>>>> Test1 <<<<<<<<<<<<< %s", a)
> assert False
E assert False
tests/test_log.py:9: AssertionError
--------------------------------------------------------------- Captured log call ---------------------------------------------------------------
INFO tests.test_log:test_log.py:8 >>>>>> Test1 <<<<<<<<<<<<< 888
============================================================ short test summary info ============================================================
FAILED tests/test_log.py::test - assert False
=============================================================== 1 failed in 0.04s ===============================================================
Please not that it also shows the log output - which is this:
INFO tests.test_log:test_log.py:8 >>>>>> Test1 <<<<<<<<<<<<< 888.
I also want to see this logging output on the VSCode snippet that shows up at failed test functions. See screenshot:
But it is missing here:

Can you add the log output?
I have a simple test:
I configuted pytest so it is logging at info level.
See pyproject.toml:
When I execute the test with
pytest testsit shows this:Please not that it also shows the log output - which is this:
INFO tests.test_log:test_log.py:8 >>>>>> Test1 <<<<<<<<<<<<< 888.I also want to see this logging output on the VSCode snippet that shows up at failed test functions. See screenshot:
But it is missing here:

Can you add the log output?