fix: derive failure status from test phase instead of exception type - #512
Merged
Conversation
All four framework reporters guessed failed vs invalid ("broken") by
matching the failure's exception type/message against a keyword list
instead of asking the framework which phase actually failed. That made
any non-AssertionError call-phase failure (custom exceptions,
pytest.fail(), timeouts) report as invalid, and let a broken
setup/teardown silently overwrite or hide a real failure -- including a
passing test whose teardown raised being reported as passed.
Every framework already exposes the phase natively (call.when for
pytest/tavern, hook_failed for behave, setup/teardown results for Robot
Framework), so each reporter now uses that instead of message-sniffing,
with a guard so a broken setup/teardown can never downgrade or overwrite
an already-failed test-body result. Fixes #511.
Breaking change: failure statuses change for real for some users, so all
four packages get a major version bump with a changelog table describing
the old vs new behavior.
The golden files under integration/*/expected/ pinned the exception-type bug: a plain `assert False` in a behave step or a Robot Framework body keyword was expected as `invalid`, and a Tavern TestFailError was expected as `invalid` even though its own step was already recorded as `failed` (an inconsistency the old logic produced). None of these failures happen in setup/teardown/hooks, so under the phase-based fix they're `failed`. qase-pytest's fixture set only exercises plain call-phase asserts, so it needed no changes. Verified locally against reporters-validator with isolated per-framework venvs mirroring the CI job (only the relevant qase-* package installed per venv, matching .github/workflows/pythonpackage.yml exactly) -- all four integration suites pass.
nismangulov
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
failedvsinvalidfrom the exception type/message instead of the test phase, so any non-AssertionErrorcall-phase failure was misreported asinvalid, and a broken setup/teardown could hide or overwrite a real failure.call.when,hook_failed,[Setup]/[Teardown]results), with a guard so a broken setup/teardown can never downgrade an already-failed result. Fixes qase-pytest: result status is derived from the exception type instead of the pytest phase #511.expected/*.yamlfixtures that pinned the old (wrong) statuses.Test plan
reporters-validatoragainst updated golden fixtures, in isolated per-framework venvs mirroring CI