Skip to content

Losing terminal markup when writing it out to a file #9593

Answered by jeffwright13
jeffwright13 asked this question in Q&A
Discussion options

You must be logged in to vote

Figured it out! My 'tee' code was writing plain text to the output file. After examining _pytest/_io/terminalwriter.py, I figured out that I could just instantiate the TerminalWriter class, and then use its markup method to ANSI-encode my text before writing it to file.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jeffwright13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants