Print test name at start if the log level is INFO or lower
This commit is contained in:
@@ -3,6 +3,7 @@ import logging
|
||||
|
||||
from caproto.sync.client import read
|
||||
import pytest
|
||||
from pytest import TestReport
|
||||
|
||||
from src.classes import read_config, IocNotRunning
|
||||
|
||||
@@ -89,3 +90,16 @@ def configure_motor_logging(request):
|
||||
logger = logging.getLogger("motor")
|
||||
logger.handlers.clear()
|
||||
logger.setLevel(level)
|
||||
|
||||
# Level of the pytest logger
|
||||
logger = logging.getLogger("pytest")
|
||||
logger.setLevel(level)
|
||||
|
||||
|
||||
def pytest_runtest_logreport(report: TestReport):
|
||||
"""
|
||||
Print the start of a test if the log level of the motor is INFO or lower.
|
||||
"""
|
||||
loglevel = logging.getLogger("pytest").getEffectiveLevel()
|
||||
if loglevel <= logging.INFO and report.when == 'call':
|
||||
print(f"Running test: {report.nodeid}")
|
||||
|
||||
Reference in New Issue
Block a user