pytest.ini介绍

1.pytest.ini是什么 ?

pytest.ini文件是pytest的主配置文件;pytest.ini文件的位置一般放在项目的根目录下,不能随便放,也不能更改名字。在pytest.ini文件中都是存放的一些配置选项 ,这些选项都可以通过pytest -h查看到 。

2.pytest.ini的编写格式

你可能已经看到 ,它的后缀是ini ,这也是标准配置文件的一种 ,而pytest也仅仅是引用了这种配置文件 ,所以 ,既然使用了这种文件,你就得知道它的规则 。

INI文件由节、键、值组成。

节   section

选项/参数(键=值)   name=value

注释   注释使用分号表示(;)。在分号后面的文字,直到该行结尾都全部为注释。

3.pytest.ini包含的选项

我们知道了ini文件的编写规则 ,但是你知道pytest.ini里的选项是怎么定义的呢 ?是随意写还是有要求呢 ?其实在pytest.ini里能添加哪些,都是事先已经定义好了 ,你可以打开cmd窗口执行pytest -h查看 。以下这些都是在pytest.ini里能定义的选项 。

https://zhuanlan.zhihu.com/p/677177907

相关推荐
2601_9623878210 分钟前
web自动化测试实战教程【selenium/unittest/pytest】【共193课
selenium·pytest·devops·web自动化测试·unittest
weixin_440730502 小时前
使用pytest中方法控制执行步骤(test_begin.py、test_end.py,@pytest.mark.run(order=1))
开发语言·python·pytest
2601_962297253 小时前
Python、Pytest、Allure、Selenium和Jenkins实现自动化测试集成实例
python·selenium·jenkins·pytest·allure
2601_962077601 天前
从零搭建Python接口自动化测试框架:pytest+requests实战指南
python·pytest·接口自动化·requests·框架搭建
weixin_440730501 天前
pytest结合allure生成html测试报告(step、story、severity、screenshot)
前端·html·pytest·allure报告
拜托多多指教1 天前
【Pytest框架学习】分层架构
python·pytest
2601_962299881 天前
python脚本如何单元测试
python·单元测试·pytest·unittest·mock对象
Tizzy JJ2 天前
Python + pytest 接口自动化测试框架实战:从零搭建企业级项目骨架
开发语言·python·pytest
Tizzy JJ2 天前
接口自动化测试实战:如何围绕真实业务场景设计高质量用例
python·自动化·pytest
测试老哥3 天前
Pytest 之assert断言的使用
自动化测试·软件测试·python·测试工具·测试用例·pytest·接口测试