-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
plugin: loggingrelated to the logging builtin pluginrelated to the logging builtin plugintype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Hi,
I have a following files with contents:
I would expect that log message from pytest_runtest_logreport() also appears in log-file.txt
.
As far as I know pytest_runtest_logreport() runs after the setup, call and teardown methods.
conftest.py
import logging
logger = logging.getLogger(__name__)
def pytest_runtest_setup(item):
logger.info("logger - from setup")
def pytest_runtest_call(item):
logger.info("logger - from call")
def pytest_runtest_teardown(item):
logger.info("logger - from teardown")
def pytest_runtest_logreport(report):
logger.info("logger - from logreport")
test_example.py
def test_example():
assert False
starter command
python3 -m pytest --log-level=debug --log-file=log-file.txt -lvs test_example.py
log-file.txt content:
conftest.py 5 INFO logger - from setup
conftest.py 8 INFO logger - from call
conftest.py 11 INFO logger - from teardown
Thanks for the help.
Metadata
Metadata
Assignees
Labels
plugin: loggingrelated to the logging builtin pluginrelated to the logging builtin plugintype: bugproblem that needs to be addressedproblem that needs to be addressed