Skip to content

fix: derive failure status from test phase instead of exception type - #512

Merged
gibiw merged 2 commits into
mainfrom
fix/511-status-from-phase-not-exception-type
Aug 31, 2026
Merged

fix: derive failure status from test phase instead of exception type#512
gibiw merged 2 commits into
mainfrom
fix/511-status-from-phase-not-exception-type

Conversation

@gibiw

@gibiw gibiw commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • All four reporters (pytest, tavern, behave, robotframework) guessed failed vs invalid from the exception type/message instead of the test phase, so any non-AssertionError call-phase failure was misreported as invalid, and a broken setup/teardown could hide or overwrite a real failure.
  • Each reporter now uses the phase signal the framework already exposes (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.
  • Updated integration expected/*.yaml fixtures that pinned the old (wrong) statuses.
  • Breaking change: major version bump for all four packages, with a changelog table per package.

Test plan

  • Unit tests for all four packages pass (309 total)
  • Local repro scripts confirm corrected statuses for each framework
  • Integration suites validated via reporters-validator against updated golden fixtures, in isolated per-framework venvs mirroring CI

gibiw added 2 commits August 31, 2026 11:08
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.
@gibiw
gibiw merged commit 8220b11 into main Aug 31, 2026
37 checks passed
@gibiw
gibiw deleted the fix/511-status-from-phase-not-exception-type branch August 31, 2026 10:06
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.

qase-pytest: result status is derived from the exception type instead of the pytest phase

2 participants