我在circleci
收到来自管道的弃用警告
消息
/home/circleci/evobench/env/lib/python3.7/site-packages/_pytest/junitxml.py:436: PytestDeprecationWarning: The 'junit_family' default value will change to 'xunit2' in pytest 6.0.
命令
- run:
name: Tests
command: |
. env/bin/activate
mkdir test-reports
python -m pytest --junitxml=test-reports/junit.xml
我应该如何修改命令以使用xunit? 是否可以使用消息中提到的默认工具? 我的意思是没有指定xunit或junit
这是完整的pipeline
有关从xunit1移动到xunit2的官方声明/文件,请阅读:docs.pytest.org
此外,如果您的项目包含pytest.ini文件,则可以直接从文件中设置junit\u系列用法,如:
以这种方式运行您的命令
与xunit2
python -m pytest -o junit_family=xunit2 junitxml=test-reports/junit.xml
与xunit1
python -m pytest -o junit_family=xunit1 junitxml=test-reports/junit.xml
或python -m pytest -o junit_family=legacy junitxml=test-reports/junit.xml
This here详细描述了更改:
在pytest.ini文件中添加以下行:
如果要保留
junitxml
选项的默认行为。也可以接受新版本xunit2
,但不显式定义junit_族变量从本质上讲,警告所说的是您在您的应用程序中提供了
junitxml
选项节未指定junit\u族变量。您需要开始显式定义它以删除警告或接受新的默认值
This thread goes into more details about where to find the .ini file for pytest.
相关问题 更多 >
编程相关推荐