11from __future__ import annotations
22
3- import asyncio
3+ import contextlib
44import os
55import subprocess
66
@@ -36,8 +36,10 @@ def pytest_addoption(parser: Parser) -> None:
3636
3737@pytest .fixture (autouse = True , scope = "session" )
3838def install_playwright ():
39- subprocess .run (["playwright" , "install" , "chromium" ], check = True ) # noqa: S607, S603
40- subprocess .run (["playwright" , "install-deps" ], check = True ) # noqa: S607, S603
39+ subprocess .run (["playwright" , "install" , "chromium" ], check = True ) # noqa: S607
40+ # Try to install system deps, but don't fail if already installed or no root access
41+ with contextlib .suppress (subprocess .CalledProcessError ):
42+ subprocess .run (["playwright" , "install-deps" ], check = True ) # noqa: S607
4143
4244
4345@pytest .fixture (autouse = True , scope = "session" )
@@ -49,7 +51,7 @@ def rebuild():
4951 # passed to the subprocess.
5052 env = os .environ .copy ()
5153 env .pop ("HATCH_ENV_ACTIVE" , None )
52- subprocess .run (["hatch" , "build" , "-t" , "wheel" ], check = True , env = env ) # noqa: S607, S603
54+ subprocess .run (["hatch" , "build" , "-t" , "wheel" ], check = True , env = env ) # noqa: S607
5355
5456
5557@pytest .fixture (autouse = True , scope = "function" )
0 commit comments