15 lines
400 B
Python
15 lines
400 B
Python
import logging
|
|
import pytest
|
|
|
|
|
|
# 在测试开始前配置日志
|
|
@pytest.fixture(autouse=True, scope="session")
|
|
def configure_logging():
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)",
|
|
datefmt="%Y-%m-%d %H:%M:%S",
|
|
)
|
|
# 返回一个日志对象供测试函数使用
|
|
return logging.getLogger()
|