Pytest配置文件pytest.ini如何编写生成日志文件?

1、新建pytest.ini文件

python 复制代码
[pytest]
log_cli=true
log_leveL=NOTSET
log_format = %(asctime)s %(levelname)s %(message)s %(filename)s %(funcName)s %(lineno)d
log_date_format = %Y-%m-%d %H:%M:%S

log_file = ./logdata/log.log
log_file_level = info
log_file_format = %(asctime)s %(levelname)s %(message)s %(filename)s %(funcName)s %(lineno)d
log_file _date_format = %Y-%m-%d %H:%M:%S

关闭日志

复制代码
log_cli=true 改成 log_cli=false
相关推荐
测试开发技术5 小时前
如何在 Pytest 中调用其他用例返回的接口参数?
面试·自动化·pytest·接口·接口测试·api测试
思则变1 天前
[Pytest][Part 4]多种测试运行方式
pytest
程序员三藏1 天前
如何使用Pytest进行测试?
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·pytest
一个处女座的测试3 天前
Python语言+pytest框架+allure报告+log日志+yaml文件+mysql断言实现接口自动化框架
python·mysql·pytest
思则变6 天前
[Pytest][Part 1]Pytest 自动化测试框架
pytest
思则变8 天前
[Pytest] [Part 2]增加 log功能
开发语言·python·pytest
思则变8 天前
[Pytest][Part 3]检测python package状态
pytest
cooldream200922 天前
pytest 框架详解与实战指南
pytest·测试
慕城南风22 天前
【pytest进阶】Pytest之conftest详解
pytest