diff --git a/playwright/_impl/_browser_type.py b/playwright/_impl/_browser_type.py index b34d224d6..bedc5ea73 100644 --- a/playwright/_impl/_browser_type.py +++ b/playwright/_impl/_browser_type.py @@ -171,7 +171,7 @@ def _user_data_dir(self, userDataDir: Optional[Union[str, Path]]) -> str: # Can be dropped once we drop Python 3.9 support (10/2025): # https://github.com/python/cpython/issues/82852 if sys.platform == "win32" and sys.version_info[:2] < (3, 10): - return pathlib.Path.cwd() / userDataDir + return str(pathlib.Path.cwd() / userDataDir) return str(Path(userDataDir).resolve()) return str(Path(userDataDir)) diff --git a/tests/common/test_signals.py b/tests/common/test_signals.py index 472e74042..174eaf6f2 100644 --- a/tests/common/test_signals.py +++ b/tests/common/test_signals.py @@ -27,6 +27,10 @@ def _test_signals_async( browser_name: str, launch_arguments: Dict, wait_queue: "multiprocessing.Queue[str]" ) -> None: + # On Windows, hint to mypy and pyright that they shouldn't check this function + if sys.platform == "win32": + return + os.setpgrp() sigint_received = False @@ -67,6 +71,10 @@ async def main() -> None: def _test_signals_sync( browser_name: str, launch_arguments: Dict, wait_queue: "multiprocessing.Queue[str]" ) -> None: + # On Windows, hint to mypy and pyright that they shouldn't check this function + if sys.platform == "win32": + return + os.setpgrp() sigint_received = False @@ -103,6 +111,10 @@ def my_sig_handler(signum: int, frame: Any) -> None: def _create_signals_test( target: Any, browser_name: str, launch_arguments: Dict ) -> None: + # On Windows, hint to mypy and pyright that they shouldn't check this function + if sys.platform == "win32": + return + wait_queue: "multiprocessing.Queue[str]" = multiprocessing.Queue() process = multiprocessing.Process( target=target, args=[browser_name, launch_arguments, wait_queue]