You can configure how the test suite handles windowing and visibility using environment variables.
Headless Mode
To run tests without creating an on-screen display (improving speed and ergonomics), set TEST_VISIBLE=false:
$ TEST_VISIBLE=false uv run --with tox,tox-uv tox
Note: Some tests in test_checks.py may still run in a windowed mode.
Windowing Backends (TEST_WINDOWING)
The TEST_WINDOWING flag selects the backend for tests/gl, tests/gles, and tests/glu suites:
| Variable | Value | Description |
|---|
TEST_WINDOWING | glfw | (Default) Creates an on-screen window using GLFW. |
TEST_WINDOWING | pygame | Creates an on-screen window using Pygame. |
TEST_WINDOWING | egl | A headless backend that renders directly to a GPU via EGL_EXT_platform_device. Ideal for CI/Containers (e.g., NVIDIA container runtime). |
EGL Configuration
When using TEST_WINDOWING=egl:
- It forces
PYOPENGL_PLATFORM=egl. - It serves both desktop OpenGL and OpenGL-ES contexts via an offscreen pbuffer.
TEST_VISIBLE and TEST_DWELL do not apply.- Use
TEST_EGL_DEVICE=<n> to pin a specific EGL device index (defaults to the first non-software device).
# Run headlessly
$ TEST_VISIBLE=false uv run --with tox,tox-uv tox
# Run using EGL (Headless/CI)
$ TEST_WINDOWING=egl uv run --with tox,tox-uv tox
# Run using Pygame
$ TEST_WINDOWING=pygame uv run --with tox,tox-uv tox