--- id: pytest-xvfb version: "3.1.1" license: MIT license_treatment: permissive maintenance: aging --- # pytest-xvfb — A pytest plugin to run Xvfb (or Xephyr/Xvnc) for tests. License: permissive · Maintenance: aging · Downloads: 229.2K/mo ## 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 above — verify before relying. A pytest plugin that automatically runs tests with Xvfb (or Xephyr/Xvnc) to provide a virtual display, eliminating GUI windows during test execution and enabling headless testing on systems without a display. 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 pip install pytest-xvfb uv add pytest-xvfb poetry add pytest-xvfb ## Installing pytest-xvfb 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). 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 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. 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_current - Install friction: low - Maintenance: aging - Downloads: 229.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest virtual display, headless GUI testing, xvfb pytest plugin, CI display automation, pytest xvfb xephyr, headless test runner, virtual framebuffer testing, gui-testing, ci-automation, headless [View on SkillFed](https://skillfed.io/packages/pytest-xvfb) · [View on PyPI](https://pypi.org/project/pytest-xvfb/)