Skip to content

Commit 87ec4a7

Browse files
Fix: tests fail when 'playwright install-deps' has already run (#1313)
Co-authored-by: Archmonger <16909269+Archmonger@users.noreply.github.com>
1 parent 51198af commit 87ec4a7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/conftest.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
import asyncio
3+
import contextlib
44
import os
55
import subprocess
66

@@ -36,8 +36,10 @@ def pytest_addoption(parser: Parser) -> None:
3636

3737
@pytest.fixture(autouse=True, scope="session")
3838
def 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

Comments
 (0)