Skip to content

Fix pytest.fail() not captured in cucumber JSON step output#811

Open
jackhenderson101 wants to merge 1 commit into
pytest-dev:masterfrom
jackhenderson101:fix/pytest-fail-cucumber-json
Open

Fix pytest.fail() not captured in cucumber JSON step output#811
jackhenderson101 wants to merge 1 commit into
pytest-dev:masterfrom
jackhenderson101:fix/pytest-fail-cucumber-json

Conversation

@jackhenderson101

Copy link
Copy Markdown

pytest.fail() raises _pytest.outcomes.Failed which inherits from BaseException, not Exception. The except Exception handler in _execute_step_function was bypassing the pytest_bdd_step_error hook, leaving the step's failed flag as False and causing all steps to appear as "passed" in the JSON output even when the test failed.

pytest.fail() raises _pytest.outcomes.Failed which inherits from
BaseException, not Exception. The except Exception handler in
_execute_step_function was bypassing the pytest_bdd_step_error hook,
leaving the step's failed flag as False and causing all steps to appear
as "passed" in the JSON output even when the test failed.

https://claude.ai/code/session_012zuaUetLWHn9VgJZ99moaX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants