0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Pytestのjunitxmlオプションを付けると警告がでた

Posted at

現象

pytestの勉強中に、テスト結果をJUnit形式で出力してJenkinsに食わせようと思い、--jnuixmlオプションを付けたら下記の警告メッセージが表示された

============================================================== warnings summary ==============================================================
/usr/local/lib/python3.7/site-packages/_pytest/junitxml.py:436
  /usr/local/lib/python3.7/site-packages/_pytest/junitxml.py:436: PytestDeprecationWarning: The 'junit_family' default value will change to 'xunit2' in pytest 6.0.
  Add 'junit_family=xunit1' to your pytest.ini file to keep the current format in future versions of pytest and silence this warning.
    _issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
----------------------------------- generated xml file: /Users/hoge/hoge/sandbox/python/pytest/path ------------------------------------

解決策

公式ドキュメントlink-1を見ると、pytest.iniにjunit_familyを明示すれば良いと書いてあったので、同じディレクトリ内に保存して実行すれば無事に警告が消えた。

#pytest.ini
[pytest]
junit_family=legacy

参考URL

Deprecations and Removals

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?