| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: pytest-xvfb |
| 3 |
Version: 3.0.0 |
| 4 |
Summary: A pytest plugin to run Xvfb (or Xephyr/Xvnc) for tests. |
| 5 |
Author-email: Florian Bruhin <[email protected]> |
| 6 |
Maintainer-email: Florian Bruhin <[email protected]> |
| 7 |
License: MIT |
| 8 |
Project-URL: Homepage, https://github.com/The-Compiler/pytest-xvfb |
| 9 |
Classifier: Development Status :: 4 - Beta |
| 10 |
Classifier: Intended Audience :: Developers |
| 11 |
Classifier: Topic :: Software Development :: Testing |
| 12 |
Classifier: Programming Language :: Python |
| 13 |
Classifier: Programming Language :: Python :: 3 :: Only |
| 14 |
Classifier: Programming Language :: Python :: 3 |
| 15 |
Classifier: Programming Language :: Python :: 3.7 |
| 16 |
Classifier: Programming Language :: Python :: 3.8 |
| 17 |
Classifier: Programming Language :: Python :: 3.9 |
| 18 |
Classifier: Programming Language :: Python :: 3.10 |
| 19 |
Classifier: Programming Language :: Python :: 3.11 |
| 20 |
Classifier: Programming Language :: Python :: Implementation :: CPython |
| 21 |
Classifier: Programming Language :: Python :: Implementation :: PyPy |
| 22 |
Classifier: Operating System :: OS Independent |
| 23 |
Classifier: License :: OSI Approved :: MIT License |
| 24 |
Requires-Python: >=3.7 |
| 25 |
Description-Content-Type: text/x-rst |
| 26 |
License-File: LICENSE |
| 27 |
|
| 28 |
pytest-xvfb |
| 29 |
=================================== |
| 30 |
|
| 31 |
A pytest plugin to run `Xvfb`_ (or `Xephyr`_/`Xvnc`_) for tests. |
| 32 |
|
| 33 |
---- |
| 34 |
|
| 35 |
Installation |
| 36 |
------------ |
| 37 |
|
| 38 |
You can install "`pytest-xvfb`_" via `pip`_ from `PyPI`_:: |
| 39 |
|
| 40 |
$ pip install pytest-xvfb |
| 41 |
|
| 42 |
|
| 43 |
Usage |
| 44 |
----- |
| 45 |
|
| 46 |
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). |
| 47 |
|
| 48 |
The plugin sees Xvfb being installed as "optional", since the tests can still |
| 49 |
run without it installed. If it's unavailable, it will show an informational |
| 50 |
message, if on Linux and a ``DISPLAY`` is available. When using |
| 51 |
``--xvfb-backend xvfb``, this message will turn into a hard error instead. |
| 52 |
|
| 53 |
If you're currently using ``xvfb-run`` in something like a GitHub Actions YAML |
| 54 |
file simply remove the wrapper and install this plugin instead - then you'll |
| 55 |
also have the benefits of Xvfb locally. |
| 56 |
|
| 57 |
Features |
| 58 |
-------- |
| 59 |
|
| 60 |
You can pass ``--no-xvfb`` to explicitly turn off Xvfb (e.g. to visually |
| 61 |
inspect a failure). |
| 62 |
|
| 63 |
With ``--xvfb-backend xephyr`` or ``--xvfb-backend xvnc``, you can use Xephyr |
| 64 |
or Xvnc in place of Xvfb, e.g. to visually inspect failures. |
| 65 |
|
| 66 |
**NOTE:** Support for ``xvnc`` is currently experimental and not tested on CI, |
| 67 |
due to incompatibilities with PyVirtualDisplay and Ubuntu 22.04's tightvncserver. |
| 68 |
|
| 69 |
You can mark tests with ``@pytest.mark.no_xvfb`` to skip them when they're |
| 70 |
running with Xvfb. |
| 71 |
|
| 72 |
A ``xvfb`` fixture is available with the following attributes: |
| 73 |
|
| 74 |
- ``width``: The configured width of the screen. |
| 75 |
- ``height``: The configured height of the screen. |
| 76 |
- ``colordepth``: The configured colordepth of the screen. |
| 77 |
- ``args``: The arguments to be passed to Xvfb. |
| 78 |
- ``display``: The display number (as int) which is used. |
| 79 |
- ``backend``: Either ``None`` (Xvfb), ``"xvfb"``, ``"xephyr"``, or ``"xvnc"``. |
| 80 |
|
| 81 |
In a pytest.ini, ``xvfb_width``, ``xvfb_height``, ``xvfb_colordepth`` and |
| 82 |
``xvfb_args`` can be used to configure the respective values. In addition, |
| 83 |
``xvfb_xauth`` can be set to ``true`` to generate an ``Xauthority`` token. |
| 84 |
|
| 85 |
Contributing |
| 86 |
------------ |
| 87 |
|
| 88 |
Contributions are very welcome. Tests can be run with `tox`_, please ensure |
| 89 |
the coverage at least stays the same before you submit a pull request. |
| 90 |
|
| 91 |
License |
| 92 |
------- |
| 93 |
|
| 94 |
Distributed under the terms of the `MIT`_ license, "pytest-xvfb" is free and open source software |
| 95 |
|
| 96 |
Thanks |
| 97 |
------ |
| 98 |
|
| 99 |
This `pytest`_ plugin was generated with `Cookiecutter`_ along with |
| 100 |
`@hackebrot`_'s `Cookiecutter-pytest-plugin`_ template. |
| 101 |
|
| 102 |
Thanks to `@cgoldberg`_ for `xvfbwrapper`_ which was the inspiration for this |
| 103 |
project. |
| 104 |
|
| 105 |
Issues |
| 106 |
------ |
| 107 |
|
| 108 |
If you encounter any problems, please `file an issue`_ along with a detailed description. |
| 109 |
|
| 110 |
.. _`pytest-xvfb`: https://pypi.python.org/pypi/pytest-xvfb/ |
| 111 |
.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter |
| 112 |
.. _`@hackebrot`: https://github.com/hackebrot |
| 113 |
.. _`@cgoldberg`: https://github.com/cgoldberg |
| 114 |
.. _`xvfbwrapper`: https://github.com/cgoldberg/xvfbwrapper |
| 115 |
.. _`MIT`: http://opensource.org/licenses/MIT |
| 116 |
.. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin |
| 117 |
.. _`file an issue`: https://github.com/The-Compiler/pytest-xvfb/issues |
| 118 |
.. _`pytest`: https://github.com/pytest-dev/pytest |
| 119 |
.. _`tox`: https://tox.readthedocs.org/en/latest/ |
| 120 |
.. _`pip`: https://pypi.python.org/pypi/pip/ |
| 121 |
.. _`PyPI`: https://pypi.python.org/pypi |
| 122 |
.. _`Xvfb`: https://en.wikipedia.org/wiki/Xvfb |
| 123 |
.. _`Xephyr`: https://www.freedesktop.org/wiki/Software/Xephyr/ |
| 124 |
.. _`Xvnc`: https://tigervnc.org/doc/Xvnc.html |