-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix ANSI escape codes for colored output not handled correctly with pytest.fail(..., pytrace=False) #12959
Fix ANSI escape codes for colored output not handled correctly with pytest.fail(..., pytrace=False) #12959
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the PR, appreciate it!
Thanks @leonarduschen! Will squash/merge in a few days to give others a chance to review it. 👍 |
Sure thing @nicoddemus, thanks for the review! Excited for my first contribution :) |
Backport to 8.3.x: 💚 backport PR created✅ Backport PR branch: Backported as #12990 🤖 @patchback |
- When `ReprEntry.style == "value"` (happens when calling `pytest.fail(..., pytrace=False)`, the message should not be printed to terminal using `TerminalWriter._write_source` because then it'll try to highlight the message as source code - The message should be printed to terminal directly using `TerminalWriter.line` or `TerminalWriter.write`, I went with the later for testing purposes #12959 (comment) Closes #12849 (cherry picked from commit 76e0444)
- When `ReprEntry.style == "value"` (happens when calling `pytest.fail(..., pytrace=False)`, the message should not be printed to terminal using `TerminalWriter._write_source` because then it'll try to highlight the message as source code - The message should be printed to terminal directly using `TerminalWriter.line` or `TerminalWriter.write`, I went with the later for testing purposes #12959 (comment) Closes #12849 (cherry picked from commit 76e0444) Co-authored-by: Leonardus Chen <[email protected]>
Closes #12849
Description:
ReprEntry.style == "value"
(happens when callingpytest.fail(..., pytrace=False)
, the message should not be printed to terminal usingTerminalWriter._write_source
because then it'll try to highlight the message as source codeTerminalWriter.line
orTerminalWriter.write
, I went with the later for testing purposes Fix ANSI escape codes for colored output not handled correctly with pytest.fail(..., pytrace=False) #12959 (comment)closes #XYZW
to the PR description and/or commits (whereXYZW
is the issue number). See the github docs for more information.changelog
folder, with a name like<ISSUE NUMBER>.<TYPE>.rst
. See changelog/README.rst for details.AUTHORS
in alphabetical order.