Skip to main content
See Build Status on Travis CI See Build Status on AppVeyor

A pytest plugin to run Xvfb for tests.


Installation

You can install “pytest-xvfb” via pip from PyPI:

$ pip install pytest-xvfb

Usage

With Xvfb and the plugin installed, your testsuite automatically runs with Xvfb. This allows tests to be run without windows popping up during GUI tests or on systems without a display (like a CI).

If Xvfb is not installed, the plugin does not run and your tests will still work as normal.

If you’re currently using xvfb-run in something like .travis.yml, simply remove it and install this plugin instead - then you’ll also have the benefits of Xvfb locally.

Features

You can pass --no-xvfb to explicitly turn off Xvfb (e.g. to visually inspect a failure).

You can mark tests with @pytest.mark.no_xvfb to skip them when they’re running with Xvfb.

A xvfb fixture is available with the following attributes:

  • width: The configured width of the screen.

  • height: The configured height of the screen.

  • colordepth: The configured colordepth of the screen.

  • args: The arguments to be passed to Xvfb.

  • display: The display number (as int) which is used.

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, “pytest-xvfb” is free and open source software

Thanks

This pytest plugin was generated with Cookiecutter along with @hackebrot’s Cookiecutter-pytest-plugin template.

Thanks to @cgoldberg for xvfbwrapper which was the inspiration for this project.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Metadata

Release files for pytest-xvfb 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-xvfb 0.3.0
File Size Uploaded
pytest-xvfb-0.3.0.tar.gz 4.6 kB Details

Release files / pytest-xvfb-0.3.0.tar.gz

Download URL pytest-xvfb-0.3.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
93df221046ee2a84a0436eea49dc337478d84bd788c15d3797e3f0332c5eb55f
BLAKE2b-256 checksum
How to use checksums
fcc99e5948400555e260b474152a2d0e772a62978408e4814db45274c37bf9d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.1.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

This release

0.3.0 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page