Skip to content

Add colour to unittest output #127221

Closed
Closed

Description

@hugovk

Feature or enhancement

In Python 3.13, we added colour output to the new REPL, tracebacks and doctest, that can also be controlled with the PYTHON_COLORS, NO_COLOR and FORCE_COLOR environment variables:

Let's add colour to unittest output.

Linked PRs

Activity

  1. added
    type-featureA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 24, 2024
  2. self-assigned this
    on Nov 24, 2024
  3. terryjreedy commented on Nov 24, 2024

    @terryjreedy
    Member

    Please see #127060. For the new REPL, ANSI sequences are added to the output stream only on non-Windows systems. A GUI-based program like IDLE could learn to intercept the codes and converted to GUI-specific manipulations of the text widget. But on Windows, the console is manipulated directly, and GUI-based programs are left in the dust. I think there should first be a option to get output streams consistent across systems, with or without color codes, before extending this behavior to more output.

  4. hugovk commented on Dec 3, 2024

    @hugovk
    MemberAuthor

    @terryjreedy I don't quite follow, are you saying that there's no colour support for GUIs such as IDLE on Windows, and that we shouldn't add more colour handling until we can add colour for IDLE on Windows?

    If so, I don't think adding colour to unittest needs to wait, as running unittest from IDLE seems somewhat of an edge case.

    also, I'm not sure about the connection to #127060, that's a Linux-only bug (and when using a custom sys.excepthook).

  5. added a commit that references this issue on Dec 5, 2024
  6. added a commit that references this issue on Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions