From 32a38e8802c8d6864ee1626dc3eeede9fa39c2b9 Mon Sep 17 00:00:00 2001 From: Max Berger Date: Sat, 28 Mar 2026 09:29:55 +0100 Subject: [PATCH] Proper install of playwright for TOX invocations --- integ_tests/README.md | 22 ++++++++++++++++++---- pyproject.toml | 3 +++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/integ_tests/README.md b/integ_tests/README.md index cf80093d..ccd21d22 100644 --- a/integ_tests/README.md +++ b/integ_tests/README.md @@ -6,29 +6,43 @@ These tests use Playwright to run the tests agains a full Radicale instance. You need to install playwright. The easiest way to do this is to create a .venv with playwright inside. You can do this by trying to run the integ tests and then entering the .venv +### UV + Assuming you use uv to run/create your .venvs, note that the invocation will fail: -``` lang=shell +```lang=shell uv run --extra integ_test pytest integ_tests source .venv/bin/activate ``` then run -``` lang=shell +```lang=shell playwright install --with-deps ``` +### Tox + +Tox will install the needed browser automatically. However, it will not automatically install the needed system depedencies, since those would need root permissions. To install all playwright with all needed libraries, run: + +```lang=shell +tox -c pyproject.toml -e integ_test exec -- playwright install --with-deps +``` + ## Running the tests +### UV + if you use uv, you can run -``` lang=shell +```lang=shell uv run --extra dev pytest integ_tests ``` +### Tox + if you use tox, you can run -``` lang=shell +```lang=shell tox -c pyproject.toml -e integ_test ``` diff --git a/pyproject.toml b/pyproject.toml index c3f8be45..fbf8b38b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,9 @@ skip_install = true [tool.tox.env.integ_test] deps = ["pytest", "pytest-playwright"] +# Store Playwright browsers inside .tox for better caching +setenv = { PLAYWRIGHT_BROWSERS_PATH = "{toxworkdir}/.playwright" } +commands_pre = [["playwright", "install", "chromium"]] commands = [["pytest", "integ_tests"]] [tool.pytest.ini_options]