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

相关推荐
黄昏恋慕黎明12 小时前
博客论坛技术迭代
python·pytest
2601_9620782314 小时前
Python接口自动化流程(pytest)
python·pytest·接口自动化·测试框架·断言
杨女士YRJ14 小时前
python+pytest+01
python·pytest
2601_962078232 天前
Python接口自动化框架:pytest
python·pytest·接口自动化·测试框架·restfulapi
2601_962078192 天前
Appium+Python+pytest自动化测试框架详解
自动化测试·python·appium·pytest·移动应用
2601_962284504 天前
安卓APP UI自动化测试:Python + UiAutomator2 + pytest + pytest-html
python·pytest·uiautomator2·ui自动化测试·安卓app
2601_962300814 天前
基于pytest的接口自动化测试:使用requests模块的实战项目与接口关联方法详解
接口自动化测试·测试用例·pytest·接口关联·requests模块
2601_962300814 天前
Python + Requests + Pytest + Excel + Allure:接口自动化测试项目实战
python·excel·pytest·allure·requests
11路没有终点5 天前
Pytest 安装、版本与第一个测试用例
测试用例·pytest
11路没有终点6 天前
pytest 参数化与 Mark 标记
pytest