From 8f9ebf04cd1cd04dc0a7ec6e66024776b3987f17 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 28 Jan 2022 20:33:28 +0000 Subject: [PATCH] Run self-check on Windows as part of CI (#11909) As discussed in #11895, mypy's test suite currently does not pass a mypy self-check when run on Windows. This should hopefully be fixed by https://github.com/python/typeshed/pull/6812, but running a self-check on Windows as part of the CI tests should help avoid this issue in the future. --- .github/workflows/test.yml | 7 ++++++- mypy/util.py | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b3740bc4b15..2551fb044482 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -75,11 +75,16 @@ jobs: toxenv: py36 tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py" debug_build: true - - name: Type check our own code + - name: Type check our own code (py37-ubuntu) python: '3.7' arch: x64 os: ubuntu-latest toxenv: type + - name: Type check our own code (py37-windows-64) + python: '3.7' + arch: x64 + os: windows-latest + toxenv: type - name: Code style with flake8 python: '3.7' arch: x64 diff --git a/mypy/util.py b/mypy/util.py index cd1e15afb4cf..2d6888dd0a2e 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -517,6 +517,8 @@ def hash_digest(data: bytes) -> str: def parse_gray_color(cup: bytes) -> str: """Reproduce a gray color in ANSI escape sequence""" + if sys.platform == "win32": + assert False, "curses is not available on Windows" set_color = ''.join([cup[:-1].decode(), 'm']) gray = curses.tparm(set_color.encode('utf-8'), 1, 89).decode() return gray @@ -580,7 +582,7 @@ def initialize_win_colors(self) -> bool: def initialize_unix_colors(self) -> bool: """Return True if initialization was successful and we can use colors, False otherwise""" - if not CURSES_ENABLED: + if sys.platform == "win32" or not CURSES_ENABLED: return False try: # setupterm wants a fd to potentially write an "initialization sequence".