Skip to content

[Bug]: pre-commit run --all-files fails on Windows #2839

@neoncube2

Description

@neoncube2

Version

local

Steps to reproduce

  1. Clone this repo
  2. On Windows, run the following commands:
python -m venv env
env\Scripts\activate
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
python -m build --wheel
playwright install
pre-commit install
pre-commit run --all-files

pre-commit run --all-files fails with these errors:

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

playwright\_impl\_browser_type.py:174: error: Incompatible return value type (got "Path", expected "str")  [return-value]
tests\common\test_signals.py:30: error: Module has no attribute "setpgrp"  [attr-defined]
tests\common\test_signals.py:70: error: Module has no attribute "setpgrp"  [attr-defined]
tests\common\test_signals.py:113: error: Module has no attribute "killpg"  [attr-defined]
tests\common\test_signals.py:113: error: Module has no attribute "getpgid"; maybe "getpid" or "getppid"?  [attr-defined]
Found 5 errors in 2 files (checked 234 source files)

flake8...................................................................Passed
isort....................................................................Passed
pyright..................................................................Failed
- hook id: pyright
- exit code: 1

c:\Users\elibl\Desktop\  playwright-python\playwright\_impl\_browser_type.py
  c:\Users\elibl\Desktop\  playwright-python\playwright\_impl\_browser_type.py:174:24 - error: Type "Path" is not assignable to return type "str"
    "Path" is not assignable to "str" (reportReturnType)
c:\Users\elibl\Desktop\  playwright-python\tests\common\test_signals.py
  c:\Users\elibl\Desktop\  playwright-python\tests\common\test_signals.py:30:8 - error: "setpgrp" is not a known attribute of module "os" (reportAttributeAccessIssue)
  c:\Users\elibl\Desktop\  playwright-python\tests\common\test_signals.py:70:8 - error: "setpgrp" is not a known attribute of module "os" (reportAttributeAccessIssue)
  c:\Users\elibl\Desktop\  playwright-python\tests\common\test_signals.py:113:8 - error: "killpg" is not a known attribute of module "os" (reportAttributeAccessIssue)
  c:\Users\elibl\Desktop\  playwright-python\tests\common\test_signals.py:113:18 - error: "getpgid" is not a known attribute of module "os" (reportAttributeAccessIssue)
5 errors, 0 warnings, 0 informations

Running python scripts/generate_async_api.py fails with similar errors, which makes developing with Windows difficult.

Expected behavior

No errors in pre-commit hook on Windows

Actual behavior

Errors

Additional context

No response

Environment

- Operating System: Windows 11
- CPU: x64
- Browser: N/A
- Python Version: 3.13.2
- Other info: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions