0
点赞
收藏
分享

微信扫一扫

Pytest----Pytest自动化测试框架中插件的安装使用和禁用方法


一、插件的安装与卸载

(1)安装插件

pip install

(2)卸载插件

pip uninstall pytest-NAME

二、常见的插件

  • pytest-django 为django app写的插件,与pytest集成
  • pytest-twisted 为twisted app写的插件
  • pytest-cov 测试覆盖率插件
  • pytest-xdist:支持并发执行的插件
  • pytest-instafail: 测试发生异常时上报失败插件
  • pytest-bdd:行为驱动测试
  • pytest-timeout: 超时插件
  • pytest-pep8: 代码规范检查
  • pytest-flakes:代码静态检查

更多插件参考 ​​【插件列表】​​

三、加载插件

在测试文件的根目录的conftest.py中使用如下方式加载:

pytest_plugins = ["name1", "name2"]

四、查看已激活插件

$ pytest --trace-config

五、禁用插件

(1)使用如下命令禁用

pytest -p no:NAME

(2)在pytest.ini中增加如下内容:

[pytest]
addopts =


举报

相关推荐

0 条评论