总结 pytest.ini
注意:windows下要去掉所有的中文,不然会出现编码问题
报错:UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xaa in position 15
pytest.ini
[pytest]
;下面为配置不同运行规则
;run cases files with check_* and test_* titles,执行check_开头和 test_开头的所有的文件,后面一定要加*
python_files = check_* test_*
;run test class with Check* and Test* titles,执行所有的以Test和Check开头的类
python_classes = Test* Check*
;run test function with check_* and test_* titles,执行所有以test_和check_开头的方法
python_functions= test_* check_*
;addopts设置默认运行pytest命令时带上的参数
;addopts = -vs
;设置执行的路径
testpaths = bilibili baidu
;忽略某些文件夹/目录
norecursedirs = result logs datas test_demo*
;日志设置
;日志开关 true false
log_cli = true
;日志级别
log_cli_level = info
;打印详细日志,相当于命令行加 -vs
addopts = --capture=no
;日志格式
log_cli_format = %(asctime)s [%(levelname)s] %(message)s (%(filename)s:%(lineno)s)
;日志时间格式
log_cli_date_format = %Y-%m-%d %H:%M:%s
;日志文件位置
log_file = ./log/test.log
;日志文件等级
log_file_level = info
;日志文件格式
log_file_format = %(asctime)s [%(levelname)s] %(message)s (%(filename)s:%(lineno)s)
;日志文件日期格式
log_file_date_format = %Y-%m-%d %H:%M:%s
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。