{"library":"pytest-xvfb","title":"pytest-xvfb","description":"pytest-xvfb is an active pytest plugin, currently at version 3.1.1, that automatically runs tests within a virtual X server like Xvfb, Xephyr, or Xvnc. This enables running graphical user interface (GUI) tests in headless environments, such as continuous integration (CI) servers, without the need for a physical display, preventing windows from unexpectedly popping up during testing.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install pytest-xvfb"],"cli":null},"imports":["import pytest; @pytest.mark.no_xvfb","def test_something(xvfb): ..."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\nimport os\n\ndef test_gui_app_runs_headless(xvfb):\n    # The test automatically runs with Xvfb started by pytest-xvfb\n    # The 'xvfb' fixture provides details about the virtual display.\n    print(f\"\\nRunning on virtual display: {xvfb.display}\")\n    print(f\"Screen resolution: {xvfb.width}x{xvfb.height}x{xvfb.colordepth}\")\n    # Example: Run a simple command that needs a display\n    # In a real scenario, you'd launch your GUI application here\n    # and perform assertions.\n    # For demonstration, we'll just check DISPLAY environment variable\n    assert os.environ.get('DISPLAY') == f':{xvfb.display}', 'DISPLAY environment variable not set correctly.'\n\n@pytest.mark.no_xvfb\ndef test_this_runs_without_xvfb():\n    # This test will explicitly not use Xvfb, even if enabled.\n    assert 'DISPLAY' not in os.environ\n","lang":"python","description":"To use `pytest-xvfb`, simply install it and `pytest`. For most use cases, tests that require a display will automatically run in a virtual framebuffer when `pytest-xvfb` is installed and a suitable backend (like `xvfb` or `xephyr`) is available on the system. You can access the `xvfb` fixture in your tests to get details about the virtual display, or use `@pytest.mark.no_xvfb` to explicitly disable the plugin for a specific test.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"3.1.1","pypi_latest":"3.1.1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.7,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.7,"import_time_s":null,"mem_mb":null,"disk_size":"31M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"33.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.7,"import_time_s":null,"mem_mb":null,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"26M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-xvfb","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":"31M"}]}}