gpt4 book ai didi

python - PyTest 弃用 : 'junit_family default value will change to ' xunit2'

转载 作者:行者123 更新时间:2023-12-03 16:08:26 37 4
gpt4 key购买 nike

我在 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 .

最佳答案

以这种方式运行您的命令。

与 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详细描述变化:

The default value of junit_family option will change to xunit2 in pytest 6.0, given that this is the version supported by default in modern tools that manipulate this type of file.

In order to smooth the transition, pytest will issue a warning in case the --junitxml option is given in the command line but junit_family is not explicitly configured in pytest.ini:

PytestDeprecationWarning: The `junit_family` default value will change to 'xunit2' in pytest 6.0.   Add `junit_family=legacy` to your

pytest.ini file to silence this warning and make your suite compatible.

In order to silence this warning, users just need to configure the junit_family option explicitly:

[pytest]
junit_family=legacy

关于python - PyTest 弃用 : 'junit_family default value will change to ' xunit2',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60212552/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com