Skip to content

Commit 9ab4db2

Browse files
authoredMay 4, 2025
chore: fix type warnings on windows (#2840)
1 parent 85a57cd commit 9ab4db2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎playwright/_impl/_browser_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _user_data_dir(self, userDataDir: Optional[Union[str, Path]]) -> str:
171171
# Can be dropped once we drop Python 3.9 support (10/2025):
172172
# https://github.com/python/cpython/issues/82852
173173
if sys.platform == "win32" and sys.version_info[:2] < (3, 10):
174-
return pathlib.Path.cwd() / userDataDir
174+
return str(pathlib.Path.cwd() / userDataDir)
175175
return str(Path(userDataDir).resolve())
176176
return str(Path(userDataDir))
177177

‎tests/common/test_signals.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
def _test_signals_async(
2828
browser_name: str, launch_arguments: Dict, wait_queue: "multiprocessing.Queue[str]"
2929
) -> None:
30+
# On Windows, hint to mypy and pyright that they shouldn't check this function
31+
if sys.platform == "win32":
32+
return
33+
3034
os.setpgrp()
3135
sigint_received = False
3236

@@ -67,6 +71,10 @@ async def main() -> None:
6771
def _test_signals_sync(
6872
browser_name: str, launch_arguments: Dict, wait_queue: "multiprocessing.Queue[str]"
6973
) -> None:
74+
# On Windows, hint to mypy and pyright that they shouldn't check this function
75+
if sys.platform == "win32":
76+
return
77+
7078
os.setpgrp()
7179
sigint_received = False
7280

@@ -103,6 +111,10 @@ def my_sig_handler(signum: int, frame: Any) -> None:
103111
def _create_signals_test(
104112
target: Any, browser_name: str, launch_arguments: Dict
105113
) -> None:
114+
# On Windows, hint to mypy and pyright that they shouldn't check this function
115+
if sys.platform == "win32":
116+
return
117+
106118
wait_queue: "multiprocessing.Queue[str]" = multiprocessing.Queue()
107119
process = multiprocessing.Process(
108120
target=target, args=[browser_name, launch_arguments, wait_queue]

0 commit comments

Comments
 (0)