pytest-xvfb
A pytest plugin to run Xvfb (or Xephyr/Xvnc) for tests.
Decision gist · record as of 2026-08-14
Yes, if you run GUI tests in CI or headless environments. The plugin has low install friction, permissive licensing, no known vulnerabilities, and recent maintenance. It is aging (last release 520 days ago) but still actively maintained. The main caveat is that Xvfb must be installed separately on your system; without it, the plugin degrades gracefully unless you explicitly require it. For projects testing graphical applications, this is a straightforward improvement over manual xvfb-run wrapping.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Xvfb (or Xephyr/Xvnc) must be installed on the system; the plugin treats it as optional and will skip gracefully if unavailable unless --xvfb-backend xvfb is explicitly set.
- Requires Python 3.9 or later.
- Low install friction with only two runtime dependencies (pytest and pyvirtualdisplay).
License · maintenance · safety
MIT (permissive) — MIT license is permissive and imposes no significant restrictions; you can use, modify, and distribute this package freely in commercial or private projects.
last release 2025-03-12 (520 days) · last repo commit 2025-11-24 · 76 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 229,227 downloads/mo, #9,136 on PyPI
Alternatives
Verify before relying
pip install pytest-xvfb
# In your test file:
import pytest
def test_gui_app():
# Tests automatically run with Xvfb when installed
pass
# Run tests:
pytest test_file.py- Whether Xvnc support is production-ready given the noted incompatibilities with PyVirtualDisplay and Ubuntu 22.04's tightvncserver.
- Performance overhead of running tests under Xvfb compared to native execution.
- Compatibility with non-Linux systems (plugin is OS-independent but Xvfb availability varies).
What it is and what it does
pytest-xvfb is a pytest plugin that integrates virtual display servers (Xvfb, Xephyr, or Xvnc) into your test workflow. When installed, it automatically provides a virtual X11 display for your test suite, preventing GUI windows from appearing during execution and enabling tests to run on headless systems like CI environments. The plugin treats the display server as optional—tests run normally if it's unavailable, but you can enforce its use with command-line flags.
The plugin offers fine-grained control: you can disable Xvfb per-test with the @pytest.mark.no_xvfb decorator, switch backends via --xvfb-backend, or configure display dimensions and color depth in pytest.ini. It exposes a xvfb fixture with attributes like width, height, colordepth, and display number, and supports dynamic disabling through a pytest hook. This makes it useful both for local GUI testing (where you can visually inspect failures) and for CI pipelines where you want to replace wrapper scripts like xvfb-run.
Use it for
- Run GUI application tests in CI/CD pipelines without a physical display or display server.
- Prevent GUI windows from popping up during local test runs while still testing graphical components.
- Switch between Xvfb, Xephyr, and Xvnc to visually inspect test failures or debug rendering issues.
- Configure virtual display dimensions and color depth per-project via pytest.ini for consistent test environments.
- Replace xvfb-run wrapper scripts in GitHub Actions or similar CI configurations with a pytest plugin.
- Skip specific tests when running under Xvfb using @pytest.mark.no_xvfb for tests that require a real display.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you run GUI tests in CI or headless environments.
The plugin has low install friction, permissive licensing, no known vulnerabilities, and recent maintenance. It is aging (last release 520 days ago) but still actively maintained. The main caveat is that Xvfb must be installed separately on your system; without it, the plugin degrades gracefully unless you explicitly require it. For projects testing graphical applications, this is a straightforward improvement over manual xvfb-run wrapping.
Install
pytest-xvfb on PyPI
Before you install
Low install friction with only two runtime dependencies (pytest and pyvirtualdisplay). The package is aging but actively maintained, with a recent release in March 2025 and ongoing repository activity. Supports current Python versions (3.9–3.13).
Xvfb (or Xephyr/Xvnc) must be installed on the system; the plugin treats it as optional and will skip gracefully if unavailable unless --xvfb-backend xvfb is explicitly set. Requires Python 3.9 or later.
License in practice
MIT license is permissive and imposes no significant restrictions; you can use, modify, and distribute this package freely in commercial or private projects.
Quickstart
pip install pytest-xvfb
# In your test file:
import pytest
def test_gui_app():
# Tests automatically run with Xvfb when installed
pass
# Run tests:
pytest test_file.py
Verify before relying
- Whether Xvnc support is production-ready given the noted incompatibilities with PyVirtualDisplay and Ubuntu 22.04's tightvncserver.
- Performance overhead of running tests under Xvfb compared to native execution.
- Compatibility with non-Linux systems (plugin is OS-independent but Xvfb availability varies).
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespytestpyvirtualdisplay |
| Maintenance | Aging 520 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 229,227 / month, #9,136 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: pytest_xvfb-3.1.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest virtual display”
- pytest-xvfbA pytest plugin that automatically runs tests with Xvfb (or…
- PyVirtualDisplayWraps Xvfb, Xephyr, and Xvnc to create virtual X11 displays for…
- xvfbwrapperManages headless X11 virtual displays using Xvfb, allowing GUI…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also PyVirtualDisplay · xvfbwrapper · sbvirtualdisplay · pytest-cython · pytest-qt · pytest-icdiff · pytest-rich · pytest-error-for-skips · pytest-logging · pytest-regressions