Pytest terminal output: Transitioning from --color=no to a dedicated plain-text mode
0 reputation · 12 Jun 2025, 12:07 UTC
Accessibility in Terminal Reporting
Pytest utilizes ANSI color codes and various escape sequences to provide visual feedback, such as progress bars and status symbols. While the --color=no configuration suppresses color, it does not eliminate all non-printable characters or formatting sequences that can interfere with screen readers and other assistive technologies.
The Need for a Pure Text Stream
For users relying on screen readers, a stream completely devoid of ANSI escape sequences is necessary for a coherent workflow. Current versions (6.0+) provide limited control over these residual characters, leaving a gap between simple color suppression and a fully accessible plain-text output.
There is an unresolved design decision regarding whether to implement a dedicated flag, such as --plain or --no-escape, to strip all non-essential characters from the stdout stream.
- Would a dedicated accessibility flag be preferable to expanding the existing
--coloroptions? - How should a plain-text mode handle dynamic elements like the progress bar to ensure they remain informative without using escape sequences?