Skip to content

Tests won't run on Windows. FileNotFoundError: [WinError 2] The system cannot find the file specified. #17922

@ag-tafe

Description

@ag-tafe

Bug Report

Tests won't run on Windows.
FileNotFoundError: [WinError 2] The system cannot find the file specified

To Reproduce

python -m venv venv
. venv/Scripts/activate
python -m pip install -r test-requirements.txt
Collecting attrs==23.1.0
  Downloading attrs-23.1.0-py3-none-any.whl (61 kB)
     ---------------------------------------- 61.2/61.2 KB 1.6 MB/s eta 0:00:00
Collecting black==24.3.0
  Downloading black-24.3.0-cp310-cp310-win_amd64.whl (1.4 MB)
     ---------------------------------------- 1.4/1.4 MB 2.4 MB/s eta 0:00:00
Collecting click==8.1.7
  Using cached click-8.1.7-py3-none-any.whl (97 kB)
Collecting coverage==7.3.2
  Downloading coverage-7.3.2-cp310-cp310-win_amd64.whl (203 kB)
     -------------------------------------- 203.2/203.2 KB 3.1 MB/s eta 0:00:00
Collecting execnet==2.0.2
  Downloading execnet-2.0.2-py3-none-any.whl (37 kB)
Collecting filelock==3.12.4
  Downloading filelock-3.12.4-py3-none-any.whl (11 kB)
Collecting iniconfig==2.0.0
  Downloading iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Collecting lxml==4.9.2
  Downloading lxml-4.9.2-cp310-cp310-win_amd64.whl (3.8 MB)
     ---------------------------------------- 3.8/3.8 MB 2.3 MB/s eta 0:00:00
Collecting mypy-extensions==1.0.0
  Using cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
Collecting packaging==23.2
  Downloading packaging-23.2-py3-none-any.whl (53 kB)
     ---------------------------------------- 53.0/53.0 KB 1.3 MB/s eta 0:00:00
Collecting pathspec==0.11.2
  Downloading pathspec-0.11.2-py3-none-any.whl (29 kB)
Collecting platformdirs==3.11.0
  Downloading platformdirs-3.11.0-py3-none-any.whl (17 kB)
Collecting pluggy==1.4.0
  Downloading pluggy-1.4.0-py3-none-any.whl (20 kB)
Collecting psutil==5.9.6
  Downloading psutil-5.9.6-cp37-abi3-win_amd64.whl (252 kB)
     -------------------------------------- 252.3/252.3 KB 3.1 MB/s eta 0:00:00
Collecting pytest==8.1.1
  Downloading pytest-8.1.1-py3-none-any.whl (337 kB)
     -------------------------------------- 337.4/337.4 KB 3.5 MB/s eta 0:00:00
Collecting pytest-cov==4.1.0
  Downloading pytest_cov-4.1.0-py3-none-any.whl (21 kB)
Collecting pytest-xdist==3.3.1
  Downloading pytest_xdist-3.3.1-py3-none-any.whl (41 kB)
     ---------------------------------------- 41.8/41.8 KB 2.1 MB/s eta 0:00:00
Collecting ruff==0.2.0
  Downloading ruff-0.2.0-py3-none-win_amd64.whl (7.4 MB)
     ---------------------------------------- 7.4/7.4 MB 2.3 MB/s eta 0:00:00
Collecting tomli==2.0.1
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting types-psutil==5.9.5.17
  Downloading types_psutil-5.9.5.17-py3-none-any.whl (17 kB)
Collecting types-setuptools==68.2.0.0
  Downloading types_setuptools-68.2.0.0-py3-none-any.whl (50 kB)
     ---------------------------------------- 50.6/50.6 KB 2.5 MB/s eta 0:00:00
Collecting typing-extensions==4.12.2
  Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Collecting setuptools==70.0.0
  Downloading setuptools-70.0.0-py3-none-any.whl (863 kB)
     -------------------------------------- 863.4/863.4 KB 3.2 MB/s eta 0:00:00
Collecting colorama
  Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting exceptiongroup>=1.0.0rc8
  Downloading exceptiongroup-1.2.2-py3-none-any.whl (16 kB)
Collecting coverage[toml]>=5.2.1
  Downloading coverage-7.6.2-cp310-cp310-win_amd64.whl (210 kB)
     -------------------------------------- 210.1/210.1 KB 3.2 MB/s eta 0:00:00
  Downloading coverage-7.6.1-cp310-cp310-win_amd64.whl (210 kB)
     -------------------------------------- 210.1/210.1 KB 3.2 MB/s eta 0:00:00
  Downloading coverage-7.6.0-cp310-cp310-win_amd64.whl (209 kB)
     -------------------------------------- 209.2/209.2 KB 3.2 MB/s eta 0:00:00
  Downloading coverage-7.5.4-cp310-cp310-win_amd64.whl (208 kB)
     -------------------------------------- 208.5/208.5 KB 3.1 MB/s eta 0:00:00
  Downloading coverage-7.5.3-cp310-cp310-win_amd64.whl (207 kB)
     -------------------------------------- 207.4/207.4 KB 3.1 MB/s eta 0:00:00
  Downloading coverage-7.5.2-cp310-cp310-win_amd64.whl (207 kB)
     -------------------------------------- 207.4/207.4 KB 2.5 MB/s eta 0:00:00
  Downloading coverage-7.5.1-cp310-cp310-win_amd64.whl (207 kB)
     -------------------------------------- 207.5/207.5 KB 3.2 MB/s eta 0:00:00
  Downloading coverage-7.5.0-cp310-cp310-win_amd64.whl (213 kB)
     -------------------------------------- 213.2/213.2 KB 2.6 MB/s eta 0:00:00
  Downloading coverage-7.4.4-cp310-cp310-win_amd64.whl (209 kB)
     -------------------------------------- 209.2/209.2 KB 1.3 MB/s eta 0:00:00
  Downloading coverage-7.4.3-cp310-cp310-win_amd64.whl (209 kB)
     -------------------------------------- 209.8/209.8 KB 2.6 MB/s eta 0:00:00
  Downloading coverage-7.4.2-cp310-cp310-win_amd64.whl (209 kB)
     -------------------------------------- 209.8/209.8 KB 3.2 MB/s eta 0:00:00
  Downloading coverage-7.4.1-cp310-cp310-win_amd64.whl (209 kB)
     -------------------------------------- 209.7/209.7 KB 3.2 MB/s eta 0:00:00
  Downloading coverage-7.4.0-cp310-cp310-win_amd64.whl (208 kB)
     -------------------------------------- 209.0/209.0 KB 3.2 MB/s eta 0:00:00
  Downloading coverage-7.3.4-cp310-cp310-win_amd64.whl (204 kB)
     -------------------------------------- 204.1/204.1 KB 3.1 MB/s eta 0:00:00
  Downloading coverage-7.3.3-cp310-cp310-win_amd64.whl (204 kB)
     -------------------------------------- 204.7/204.7 KB 6.3 MB/s eta 0:00:00
Installing collected packages: types-setuptools, typing-extensions, types-psutil, tomli, setuptools, ruff, psutil, pluggy, platformdirs, pathspec, packaging, mypy-extensions, lxml, iniconfig, filelock, execnet, exceptiongroup, coverage, colorama, attrs, pytest, click, pytest-xdist, pytest-cov, black
  Attempting uninstall: setuptools
    Found existing installation: setuptools 58.1.0
    Uninstalling setuptools-58.1.0:
      Successfully uninstalled setuptools-58.1.0
Successfully installed attrs-23.1.0 black-24.3.0 click-8.1.7 colorama-0.4.6 coverage-7.3.2 exceptiongroup-1.2.2 execnet-2.0.2 filelock-3.12.4 iniconfig-2.0.0 lxml-4.9.2 mypy-extensions-1.0.0 packaging-23.2 pathspec-0.11.2 platformdirs-3.11.0 pluggy-1.4.0 psutil-5.9.6 pytest-8.1.1 pytest-cov-4.1.0 pytest-xdist-3.3.1 ruff-0.2.0 setuptools-70.0.0 tomli-2.0.1 types-psutil-5.9.5.17 types-setuptools-68.2.0.0 typing-extensions-4.12.2

python -m pip install -e .
Obtaining file:///C:/Users/alex/Documents/mypy
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: typing-extensions>=4.6.0 in c:\users\alex\documents\mypy\venv\lib\site-packages (from mypy==1.13.0+dev.bd9200bda5595fc71c01fe0dff9debbce3467a84) (4.12.2)
Requirement already satisfied: mypy-extensions>=1.0.0 in c:\users\alex\documents\mypy\venv\lib\site-packages (from mypy==1.13.0+dev.bd9200bda5595fc71c01fe0dff9debbce3467a84) (1.0.0)
Requirement already satisfied: tomli>=1.1.0 in c:\users\alex\documents\mypy\venv\lib\site-packages (from mypy==1.13.0+dev.bd9200bda5595fc71c01fe0dff9debbce3467a84) (2.0.1)
Building wheels for collected packages: mypy
  Building editable for mypy (pyproject.toml): started
  Building editable for mypy (pyproject.toml): finished with status 'done'
  Created wheel for mypy: filename=mypy-1.13.0+dev.bd9200bda5595fc71c01fe0dff9debbce3467a84-0.editable-py3-none-any.whl size=8331 sha256=e8a2d92b5d4bd0ce43ef1bfc6ffe3468be10cbc4339ed212a8ee2ab83e925a4d
  Stored in directory: C:\Users\alex\AppData\Local\Temp\pip-ephem-wheel-cache-q75kwn92\wheels\a8\a2\50\134672bd449c7de0c86d513761fcba4e510333f500ed8f0efb
Successfully built mypy
Installing collected packages: mypy
Successfully installed mypy-1.13.0+dev.bd9200bda5595fc71c01fe0dff9debbce3467a84
(venv)

Expected Behavior

python runtests.py
Success: no issues found in 302 source files

Actual Behavior

python runtests.py
Traceback (most recent call last):
  File "C:\Users\alex\Documents\mypy\runtests.py", line 171, in <module>
    main()
  File "C:\Users\alex\Documents\mypy\runtests.py", line 153, in main
    proc = start_background_cmd("lint")
  File "C:\Users\alex\Documents\mypy\runtests.py", line 118, in start_background_cmd
    proc = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
  File "C:\Program Files\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified 

Your Environment

  • Windows 10 22H2
  • mintty 3.7.1
  • Mypy version used: mypy-1.13.0+dev
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: Python 3.10.4

Workaround:
Comment line 153 in runtests.py:
proc = start_background_cmd("lint")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-developerIssues relevant to mypy developers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions