cannot see ansi colors in the stdout capture call
See original GitHub issuei had run pytest
with --color=yes
in terminal and some of my tests where printing something on stdout, pytest captured the output, but ansi colors where not present.
here was the full command: pytest -vv -x -rP --color=yes --durations=0
does pytest have ansi color output support from stdout call capture ?
here im testing a function that prints colored output in my terminal
but not in pytest captured stdout call
or maybe im using the wrong flag …
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Python module to enable ANSI colors for stdout on Windows?
Your best bet is probably to use the colorama module. In fact, I believe that the Windows console does not support ANSI colors...
Read more >when output filename is set, ANSI color codes are printed to ...
Describe the bug When Catch output is redirected to a file via the --out option and color output is forced via --use-colour=yes, the...
Read more >Can less retain colored output? - Unix & Linux Stack Exchange
Use: git diff --color=always | less -r. --color=always is there to tell git to output color codes even if the output is a...
Read more >Windows console with ANSI colors handling - Super User
For Windows version below 10, the Windows command console doesn't support output coloring by default. You could install either Cmder, ConEmu, ANSICON or...
Read more >Is there a way to preserve text color codes on piped stdout ...
If a process can auto-detect if it is in a interactive terminal or not and adjust color output it will most likely have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
even if this were possible to change within pytest it would be a big breaking change to consumers of pytest if the default
isatty
were to change (for which the current assumption isisatty=False
)usually it’s best to individually test the coloring via mocking
isatty
or whatever trigger your coloring code uses – for example from all-repos or from pre-commitit wouldn’t work for all methods of color detection – only for those which use
isatty
(for instance some do color detection viacurses
or viatput
)