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

相关推荐
兴趣使然黄小黄1 天前
【Pytest】Pytest框架快速入门
python·pytest
m0_632482502 天前
Jenkins + Pytest +allure接口自动化测试配置与操作
jenkins·集成测试·pytest·jenkins配置
李星星BruceL2 天前
Pytest第三章(参考指南1)
python·自动化·pytest
哎呀呦呵2 天前
pytest基本使用
python·pytest
Kristen_YXQDN2 天前
PyCharm 中 pytest 运行 python 测试文件报错:D:\Python_file\.venv\Scripts\python.exe: No module named pytest
运维·开发语言·python·pycharm·pytest
Low--Key2 天前
pytest框架快速入门
python·自动化·pytest
姜西西_2 天前
自动化测试框架pytest之fixture
android·java·pytest
测试开发Kevin2 天前
超级实用!汇总pytest中那些常用的参数
单元测试·pytest
Beaman10242 天前
pytest框架
python·pytest
昔时扬尘处3 天前
【Files Content Replace】文件夹文件内容批量替换自动化测试脚本
c语言·python·pytest·adi