完整:ini中的参数设置
1,格式
[pytest] log_format = %(asctime)s %(levelname)s %(message)s log_date_format = %Y-%m-%d %H:%M:%S
2,addopts
添加运行参数
addopts = -q
3,testpaths
指定测试用例路径
testpaths = app/login
多个测试路径使用 空格隔开或者换行写
# testpaths = app/login app/person
testpaths = app/login app/person
4,日志信息设置
log_format = %(asctime)s %(levelname)s %(message)s log_date_format = %Y-%m-%d %H:%M:%S log_level = INFO
# 实时日志
log_cli=true
log_cli_level = INFO
log_cli_format = %(asctime)s %(levelname)s %(message)s
log_cli_date_format =%Y-%m-%d %H:%M:%S
# 日志文件log_file
log_file_level
log_file_format
log_file_date_format
5,对警告信息进行配置
[pytest] filterwarnings = error ignore::UserWarning
6,对doctest文件的设置
[pytest] addopts = --doctest-modules