Skip to content

fix: only default to headed under the VS Code debugger when a display is available - #328

Merged
Pavel Feldman (pavelfeldman) merged 2 commits into
mainfrom
fix-122-headed-without-display
Oct 8, 2026
Merged

Pavel Feldman (pavelfeldman) merged 2 commits into
mainfrom
fix-122-headed-without-display

Conversation

@pavelfeldman

@pavelfeldman Pavel Feldman (pavelfeldman) commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

When pytest is launched from the VS Code Python extension with the debugger attached, the browser was always launched headed. On Linux machines without a display server (remote SSH, WSL2, containers) that launch fails, even though --headed was never passed.

Headed is now only the default under the debugger when a display is configured: always on macOS and Windows, elsewhere when DISPLAY or WAYLAND_DISPLAY is set. This checks the environment, not that the display server is reachable; --headed still forces headed mode either way.

Tests simulate the VS Code launcher with an attached debugger: X11, Wayland, no display, and --headed without a display (sync + async).

Fixes #122

Stack created with GitHub Stacks CLI • Give Feedback 💬

… is available

When pytest is launched from the VS Code Python extension with the debugger
attached, the browser was always launched headed. On Linux machines without
a display server (remote SSH, WSL2, containers) this fails. Check for
DISPLAY / WAYLAND_DISPLAY on Linux before defaulting to headed.

Fixes #122
@pavelfeldman
Pavel Feldman (pavelfeldman) added this pull request to stack #335 October 7, 2026 23:05
@pavelfeldman Pavel Feldman (pavelfeldman) changed the title fix 122 headed without display fix: only default to headed under the VS Code debugger when a display is available Oct 7, 2026
@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit dc8396a into main Oct 8, 2026
15 checks passed
@pavelfeldman
Pavel Feldman (pavelfeldman) deleted the fix-122-headed-without-display branch October 8, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Playwright starts browser in headed mode when called from VS Code Debugger - even on headless server

2 participants