pytest offers a way to hide a method from the traceback generated in case of failure, by setting __tracebackhide__ to True in the method to exclude.
It makes a much tidier output, a bit like when not using pytest-bdd:
__________________________________________________________________ test_authenticated_access_to_the_application ___________________________________________________________________
.venv/lib/python3.10/site-packages/pytest_bdd/scenario.py:184: in scenario_wrapper
_execute_scenario(feature, scenario, request)
.venv/lib/python3.10/site-packages/pytest_bdd/scenario.py:154: in _execute_scenario
_execute_step_function(request, scenario, step, step_func)
.venv/lib/python3.10/site-packages/pytest_bdd/scenario.py:124: in _execute_step_function
return_value = call_fixture_func(fixturefunc=step_func, request=request, kwargs=kwargs)
.venv/lib/python3.10/site-packages/_pytest/fixtures.py:891: in call_fixture_func
fixture_result = fixturefunc(**kwargs)
tests/gui/step_defs/star_steps.py:36: in redirected_to_homepage
assert False
E AssertionError
becomes just:
__________________________________________________________________ test_authenticated_access_to_the_application ___________________________________________________________________
tests/gui/step_defs/star_steps.py:36: in redirected_to_homepage
assert False
E AssertionError
Would you be interested in a pull request that add this attribute to the internal methods in pytest-bdd?
pytest offers a way to hide a method from the traceback generated in case of failure, by setting
__tracebackhide__
toTrue
in the method to exclude.It makes a much tidier output, a bit like when not using pytest-bdd:
becomes just:
Would you be interested in a pull request that add this attribute to the internal methods in pytest-bdd?