no message passed to pytest.fail()
The function pytest.fail
must be called either with a positional argument
or a keyword argument msg=
. Passing a keyword argument under a wrong name
will also be reported as a violation.
Bad code:
import pytest
def test_foo():
pytest.fail()
def test_bar():
pytest.fail('')
def test_baz():
pytest.fail(reason='...') # wrong kwarg name
Good code:
import pytest
def test_foo():
pytest.fail('...')
def test_bar():
pytest.fail(msg='...')
- to make it easier to understand and debug test failures