PyTest弃用:'junit_family默认值将更改为'xunit2'

问题描述 投票:0回答:1

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

Command

- run:
    name: Tests
    command: |
      . env/bin/activate
      mkdir test-reports
      python -m pytest --junitxml=test-reports/junit.xml

如何修改命令以使用xunit?如消息中所述,是否可以使用默认工具?我的意思是不指定xunit或junit。

这里是完整的pipeline

python pytest circleci
1个回答
0
投票

在pytest.ini文件中添加以下行:

junit_family=legacy

如果要保留--junitxml选项的默认行为。或者,您可以接受新版本xunit2,但不能显式定义junit_family变量。

基本上是警告的意思是您在您的--junitxml选项中使用了>]

run           
  name: Tests

本节未指定junit_family变量。您需要开始明确定义它以删除警告或接受新的默认值。

This thread goes into more details about where to find the .ini file for pytest.

© www.soinside.com 2019 - 2024. All rights reserved.