pytest---pytest.ini

完整:ini中的参数设置

  Configuration Options

 

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

  

 

 

  

posted @ 2020-08-03 09:26  myy2  阅读(126)  评论(0编辑  收藏  举报