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_9622845013 小时前
安卓APP UI自动化测试:Python + UiAutomator2 + pytest + pytest-html
python·pytest·uiautomator2·ui自动化测试·安卓app
2601_9623008113 小时前
基于pytest的接口自动化测试:使用requests模块的实战项目与接口关联方法详解
接口自动化测试·测试用例·pytest·接口关联·requests模块
2601_9623008113 小时前
Python + Requests + Pytest + Excel + Allure:接口自动化测试项目实战
python·excel·pytest·allure·requests
11路没有终点2 天前
Pytest 安装、版本与第一个测试用例
测试用例·pytest
11路没有终点3 天前
pytest 参数化与 Mark 标记
pytest
2601_962296283 天前
五种Python自动化测试框架汇总,附学习方法
自动化测试·pytest·unittest·robotframework·python框架
11路没有终点3 天前
pytest Fixture 进阶:conftest 与依赖注入
pytest
2601_962387826 天前
web自动化测试实战教程【selenium/unittest/pytest】【共193课
selenium·pytest·devops·web自动化测试·unittest
weixin_440730506 天前
使用pytest中方法控制执行步骤(test_begin.py、test_end.py,@pytest.mark.run(order=1))
开发语言·python·pytest
2601_962297256 天前
Python、Pytest、Allure、Selenium和Jenkins实现自动化测试集成实例
python·selenium·jenkins·pytest·allure