Skip to main content

A pytest plugin to run Xvfb for tests.

Project description

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. However, a warning message will print to standard output letting you know that Xvfb is not installed.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-xvfb-1.1.0.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file pytest-xvfb-1.1.0.tar.gz.

File metadata

  • Download URL: pytest-xvfb-1.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytest-xvfb-1.1.0.tar.gz
Algorithm Hash digest
SHA256 21576c6435613b98b21e8917c6c76654f5e6766df9003c5fec8cba7fd2eede21
MD5 0754da6fb2ed04cb1604eec8c0a3deea
BLAKE2b-256 58e10545dec2b30be5566c6a226af98c0ccff62b9eecc15443df31bb490896b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page