Skip to content

MYPY_FORCE_COLOR only colours output on Windows, not macOS/Ubuntu #13817

@hugovk

Description

@hugovk

Bug Report

When using MYPY_FORCE_COLOR (or FORCE_COLOR with master) on GitHub Actions (which is not a tty), colour only shows up for Windows, and not for Ubuntu or macOS.

To Reproduce

Test with a worklflow something like this:

name: Test

on: [push, pull_request, workflow_dispatch]

env:
  MYPY_FORCE_COLOR: 1

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version: [
          "3.7",
          "3.10",
        ]
        os: [
          windows-latest,
          macOS-latest,
          ubuntu-latest,
        ]

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: |
          python -m pip install -U pip
          python -m pip install mypy

      - name: Test
        run: |
          mypy test.py

Expected Behavior

Colour output for all three operating systems.

Actual Behavior

Colour output only for Windows:

image

And not for Ubuntu:

image

Nor macOS:

image

For example: https://github.com/hugovk/test/actions/runs/3185917456

Your Environment

  • Mypy version used: 0.982
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.7 and 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-configurationConfiguration files and flags

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions