Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement #12231 new flag --xfail-tb #12280

Merged
merged 9 commits into from
May 7, 2024

Conversation

okken
Copy link
Contributor

@okken okken commented May 2, 2024

This implements issue #12231, making xfail tracebacks optional.
Add --xfail-tb flag, which turns traceback output for XFAIL results.

  • If the --xfail-tb flag is not sent, tracebacks for XFAIL results are NOT shown.
  • The style of traceback for XFAIL is set with --tb, and can be auto|long|short|line|native|no.
  • Note: Even if you have --xfail-tb set, you won't see them if --tb=no.

Some history:

  • This is a behavior break, but brings default behavior back to pre-8.0.0 behavior.
  • With this change, default -rx/ -ra behavior is identical to pre-8.0 with respect to xfail tracebacks.
  • With pytest 8.0, -rx or -ra would not only turn on summary reports for xfail, but also report the tracebacks for xfail results.
  • This caused issues with some projects that utilize xfail, but don't want to see all of the xfail tracebacks.
  • This change detaches xfail tracebacks from -rx, and now we turn on xfail tracebacks with --xfail-tb.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @okken!

I have left some minor requests, please take a look.

changelog/12231.feature.rst Outdated Show resolved Hide resolved
changelog/12231.feature.rst Outdated Show resolved Hide resolved
src/_pytest/terminal.py Outdated Show resolved Hide resolved
testing/test_terminal.py Show resolved Hide resolved
testing/test_terminal.py Show resolved Hide resolved
@okken
Copy link
Contributor Author

okken commented May 4, 2024

Looks great, thanks @okken!

I have left some minor requests, please take a look.

Thanks @nicoddemus. I like all the suggestions. I've accepted all of them.

@okken
Copy link
Contributor Author

okken commented May 4, 2024

Let me know if there's anything else needed.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks great!

I will let it open for a few more days to give others a chance of reviewing it too. 👍

@nicoddemus
Copy link
Member

(Note: we should squash/merge this)

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@okken
Copy link
Contributor Author

okken commented May 7, 2024

@nicoddemus Squash and merge ok now? Or wanna wait a bit more?

@nicoddemus nicoddemus merged commit 8efbefb into pytest-dev:main May 7, 2024
24 checks passed
@nicoddemus
Copy link
Member

Thanks @okken!

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.

3 participants