skip visual tests in CI — require explicit -m visual flag

Playwright visual tests need browser binaries (playwright install
chromium) which CI doesn't have. Mark them with pytest.mark.visual
and add addopts = "-m 'not visual'" so they're skipped by default.

Run locally with: uv run pytest -m visual tests/test_visual.py -v

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-02-13 23:59:53 +01:00
parent dc685e8e7b
commit 6bba19f628
2 changed files with 7 additions and 2 deletions

View File

@@ -43,3 +43,5 @@ ignore = ["E501"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
asyncio_mode = "auto" asyncio_mode = "auto"
testpaths = ["tests"] testpaths = ["tests"]
markers = ["visual: Playwright visual tests (require browser install)"]
addopts = "-m 'not visual'"

View File

@@ -4,8 +4,9 @@ Visual regression tests using Playwright.
Takes screenshots of key pages and verifies styling invariants Takes screenshots of key pages and verifies styling invariants
(heading colors, backgrounds, nav layout, logo presence). (heading colors, backgrounds, nav layout, logo presence).
Usage: Skipped by default (requires `playwright install chromium`).
uv run pytest tests/test_visual.py -x -v Run explicitly with:
uv run pytest -m visual tests/test_visual.py -v
Screenshots are saved to tests/screenshots/ for manual review. Screenshots are saved to tests/screenshots/ for manual review.
""" """
@@ -21,6 +22,8 @@ from playwright.sync_api import expect, sync_playwright
from padelnomics import core from padelnomics import core
from padelnomics.app import create_app from padelnomics.app import create_app
pytestmark = pytest.mark.visual
SCREENSHOTS_DIR = Path(__file__).parent / "screenshots" SCREENSHOTS_DIR = Path(__file__).parent / "screenshots"
SCREENSHOTS_DIR.mkdir(exist_ok=True) SCREENSHOTS_DIR.mkdir(exist_ok=True)