pytest-fail-without-message (PT016)
源自 flake8-pytest-style linter。
作用
检查没有消息的 pytest.fail
调用。
为什么这不好?
没有消息的 pytest.fail
调用会使理解和调试测试失败变得更加困难。
示例
import pytest
def test_foo():
pytest.fail()
def test_bar():
pytest.fail("")
def test_baz():
pytest.fail(reason="")
建议改为