Skip to content

Fix reporting for teardown errors - #14896

Open
ace2016 wants to merge 1 commit into
pytest-dev:mainfrom
ace2016:fix-1004-teardown-reporting
Open

Fix reporting for teardown errors#14896
ace2016 wants to merge 1 commit into
pytest-dev:mainfrom
ace2016:fix-1004-teardown-reporting

Conversation

@ace2016

@ace2016 ace2016 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Closes #1004.

Summary

A test whose call phase passed but whose teardown failed was previously reported as both PASSED and ERROR. This change defers successful call reporting until teardown completes. If teardown fails, only the error is reported. Call failures followed by teardown errors remain separately reported.

The internal setup, call, and teardown reports remain unchanged for plugins.

Testing

  • Focused teardown-reporting tests: 5 passed
  • Broader terminal tests: 219 passed, 2 skipped, 8 deselected
  • python -m ruff check src/_pytest/terminal.py testing/test_terminal.py
  • python -m ruff format --check src/_pytest/terminal.py testing/test_terminal.py
  • git diff --check

Checklist

  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits.
  • Add text like closes #XYZW to the PR description and/or commits.
  • If AI agents were used, they are credited in Co-authored-by commit trailers.
  • Create a new changelog file in the changelog directory.
  • Add yourself to AUTHORS in alphabetical order.

@ace2016
ace2016 force-pushed the fix-1004-teardown-reporting branch from 6bad33d to fb6ea88 Compare August 18, 2026 16:53
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Aug 18, 2026
Co-authored-by: Codex <codex@openai.com>
@ace2016
ace2016 force-pushed the fix-1004-teardown-reporting branch from fb6ea88 to ff8f92c Compare August 18, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test listed twice when there's an error during teardown

1 participant