[Python-modules-commits] [pytest-xvfb] 01/03: New upstream version 1.0.0

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Feb 9 12:34:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository pytest-xvfb.

commit 95f0e3a40e4c584b8e658c984aef089917774187
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Thu Feb 9 11:03:25 2017 +0000

    New upstream version 1.0.0
---
 PKG-INFO                                  | 117 ++++++++++++++++++++++++++++++
 README.rst                                |  93 ++++++++++++++++++++++++
 pytest_xvfb.egg-info/PKG-INFO             | 117 ++++++++++++++++++++++++++++++
 pytest_xvfb.egg-info/SOURCES.txt          |   9 +++
 pytest_xvfb.egg-info/dependency_links.txt |   1 +
 pytest_xvfb.egg-info/entry_points.txt     |   3 +
 pytest_xvfb.egg-info/requires.txt         |   2 +
 pytest_xvfb.egg-info/top_level.txt        |   1 +
 pytest_xvfb.py                            | 106 +++++++++++++++++++++++++++
 setup.cfg                                 |   5 ++
 setup.py                                  |  48 ++++++++++++
 11 files changed, 502 insertions(+)

diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..02b5ec5
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,117 @@
+Metadata-Version: 1.1
+Name: pytest-xvfb
+Version: 1.0.0
+Summary: A pytest plugin to run Xvfb for tests.
+Home-page: https://github.com/The-Compiler/pytest-xvfb
+Author: Florian Bruhin
+Author-email: me at the-compiler.org
+License: MIT
+Description: pytest-xvfb
+        ===================================
+        
+        .. image:: https://travis-ci.org/The-Compiler/pytest-xvfb.svg?branch=master
+            :target: https://travis-ci.org/The-Compiler/pytest-xvfb
+            :alt: See Build Status on Travis CI
+        
+        .. image:: https://ci.appveyor.com/api/projects/status/github/The-Compiler/pytest-xvfb?branch=master
+            :target: https://ci.appveyor.com/project/The-Compiler/pytest-xvfb/branch/master
+            :alt: 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.
+        
+        .. _`pytest-xvfb`: https://pypi.python.org/pypi/pytest-xvfb/
+        .. _`Xvfb`: http://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml
+        .. _`Cookiecutter`: https://github.com/audreyr/cookiecutter
+        .. _`@hackebrot`: https://github.com/hackebrot
+        .. _`@cgoldberg`: https://github.com/cgoldberg
+        .. _`xvfbwrapper`: https://github.com/cgoldberg/xvfbwrapper
+        .. _`MIT`: http://opensource.org/licenses/MIT
+        .. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause
+        .. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt
+        .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0
+        .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin
+        .. _`file an issue`: https://github.com/The-Compiler/pytest-xvfb/issues
+        .. _`pytest`: https://github.com/pytest-dev/pytest
+        .. _`tox`: https://tox.readthedocs.org/en/latest/
+        .. _`pip`: https://pypi.python.org/pypi/pip/
+        .. _`PyPI`: https://pypi.python.org/pypi
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: Topic :: Software Development :: Testing
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Operating System :: OS Independent
+Classifier: License :: OSI Approved :: MIT License
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..3e6da9e
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,93 @@
+pytest-xvfb
+===================================
+
+.. image:: https://travis-ci.org/The-Compiler/pytest-xvfb.svg?branch=master
+    :target: https://travis-ci.org/The-Compiler/pytest-xvfb
+    :alt: See Build Status on Travis CI
+
+.. image:: https://ci.appveyor.com/api/projects/status/github/The-Compiler/pytest-xvfb?branch=master
+    :target: https://ci.appveyor.com/project/The-Compiler/pytest-xvfb/branch/master
+    :alt: 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.
+
+.. _`pytest-xvfb`: https://pypi.python.org/pypi/pytest-xvfb/
+.. _`Xvfb`: http://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml
+.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter
+.. _`@hackebrot`: https://github.com/hackebrot
+.. _`@cgoldberg`: https://github.com/cgoldberg
+.. _`xvfbwrapper`: https://github.com/cgoldberg/xvfbwrapper
+.. _`MIT`: http://opensource.org/licenses/MIT
+.. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause
+.. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt
+.. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0
+.. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin
+.. _`file an issue`: https://github.com/The-Compiler/pytest-xvfb/issues
+.. _`pytest`: https://github.com/pytest-dev/pytest
+.. _`tox`: https://tox.readthedocs.org/en/latest/
+.. _`pip`: https://pypi.python.org/pypi/pip/
+.. _`PyPI`: https://pypi.python.org/pypi
diff --git a/pytest_xvfb.egg-info/PKG-INFO b/pytest_xvfb.egg-info/PKG-INFO
new file mode 100644
index 0000000..02b5ec5
--- /dev/null
+++ b/pytest_xvfb.egg-info/PKG-INFO
@@ -0,0 +1,117 @@
+Metadata-Version: 1.1
+Name: pytest-xvfb
+Version: 1.0.0
+Summary: A pytest plugin to run Xvfb for tests.
+Home-page: https://github.com/The-Compiler/pytest-xvfb
+Author: Florian Bruhin
+Author-email: me at the-compiler.org
+License: MIT
+Description: pytest-xvfb
+        ===================================
+        
+        .. image:: https://travis-ci.org/The-Compiler/pytest-xvfb.svg?branch=master
+            :target: https://travis-ci.org/The-Compiler/pytest-xvfb
+            :alt: See Build Status on Travis CI
+        
+        .. image:: https://ci.appveyor.com/api/projects/status/github/The-Compiler/pytest-xvfb?branch=master
+            :target: https://ci.appveyor.com/project/The-Compiler/pytest-xvfb/branch/master
+            :alt: 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.
+        
+        .. _`pytest-xvfb`: https://pypi.python.org/pypi/pytest-xvfb/
+        .. _`Xvfb`: http://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml
+        .. _`Cookiecutter`: https://github.com/audreyr/cookiecutter
+        .. _`@hackebrot`: https://github.com/hackebrot
+        .. _`@cgoldberg`: https://github.com/cgoldberg
+        .. _`xvfbwrapper`: https://github.com/cgoldberg/xvfbwrapper
+        .. _`MIT`: http://opensource.org/licenses/MIT
+        .. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause
+        .. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt
+        .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0
+        .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin
+        .. _`file an issue`: https://github.com/The-Compiler/pytest-xvfb/issues
+        .. _`pytest`: https://github.com/pytest-dev/pytest
+        .. _`tox`: https://tox.readthedocs.org/en/latest/
+        .. _`pip`: https://pypi.python.org/pypi/pip/
+        .. _`PyPI`: https://pypi.python.org/pypi
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: Topic :: Software Development :: Testing
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Operating System :: OS Independent
+Classifier: License :: OSI Approved :: MIT License
diff --git a/pytest_xvfb.egg-info/SOURCES.txt b/pytest_xvfb.egg-info/SOURCES.txt
new file mode 100644
index 0000000..74d49f9
--- /dev/null
+++ b/pytest_xvfb.egg-info/SOURCES.txt
@@ -0,0 +1,9 @@
+README.rst
+pytest_xvfb.py
+setup.py
+pytest_xvfb.egg-info/PKG-INFO
+pytest_xvfb.egg-info/SOURCES.txt
+pytest_xvfb.egg-info/dependency_links.txt
+pytest_xvfb.egg-info/entry_points.txt
+pytest_xvfb.egg-info/requires.txt
+pytest_xvfb.egg-info/top_level.txt
\ No newline at end of file
diff --git a/pytest_xvfb.egg-info/dependency_links.txt b/pytest_xvfb.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pytest_xvfb.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/pytest_xvfb.egg-info/entry_points.txt b/pytest_xvfb.egg-info/entry_points.txt
new file mode 100644
index 0000000..84b3180
--- /dev/null
+++ b/pytest_xvfb.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[pytest11]
+xvfb = pytest_xvfb
+
diff --git a/pytest_xvfb.egg-info/requires.txt b/pytest_xvfb.egg-info/requires.txt
new file mode 100644
index 0000000..5e7dc61
--- /dev/null
+++ b/pytest_xvfb.egg-info/requires.txt
@@ -0,0 +1,2 @@
+pytest>=2.8.1
+pyvirtualdisplay>=0.2.1
diff --git a/pytest_xvfb.egg-info/top_level.txt b/pytest_xvfb.egg-info/top_level.txt
new file mode 100644
index 0000000..9a8ecb6
--- /dev/null
+++ b/pytest_xvfb.egg-info/top_level.txt
@@ -0,0 +1 @@
+pytest_xvfb
diff --git a/pytest_xvfb.py b/pytest_xvfb.py
new file mode 100644
index 0000000..bf534d2
--- /dev/null
+++ b/pytest_xvfb.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import time
+import os.path
+import fnmatch
+import hashlib
+import tempfile
+import subprocess
+import sys
+
+import pyvirtualdisplay
+
+import pytest
+
+
+def xvfb_available():
+    # http://stackoverflow.com/a/28909933/2085149
+    return any(
+        os.access(os.path.join(path, 'Xvfb'), os.X_OK)
+        for path in os.environ["PATH"].split(os.pathsep)
+    )
+
+
+class XvfbExitedError(Exception):
+
+    pass
+
+
+class Xvfb(object):
+
+    def __init__(self, config):
+        self.width = int(config.getini('xvfb_width'))
+        self.height = int(config.getini('xvfb_height'))
+        self.colordepth = int(config.getini('xvfb_colordepth'))
+        self.args = config.getini('xvfb_args') or []
+        self.xauth = config.getini('xvfb_xauth')
+        self.display = None
+        self._virtual_display = None
+
+    def start(self):
+        self._virtual_display = pyvirtualdisplay.Display(
+            backend='xvfb', size=(self.width, self.height),
+            color_depth=self.colordepth, use_xauth=self.xauth)
+        self._virtual_display.cmd.extend(self.args)
+        self._virtual_display.start()
+        self.display = self._virtual_display.display
+
+        if not self._virtual_display.is_alive():
+            ret = self._virtual_display.return_code
+            raise XvfbExitedError("Xvfb exited with exit code {0}".format(ret))
+
+    def stop(self):
+        self._virtual_display.stop()
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup('xvfb')
+    group.addoption(
+        '--no-xvfb',
+        action='store_true',
+        help='Disable Xvfb for tests.'
+    )
+
+    parser.addini('xvfb_width', 'Width of the Xvfb display', default='800')
+    parser.addini('xvfb_height', 'Height of the Xvfb display', default='600')
+    parser.addini('xvfb_colordepth', 'Color depth of the Xvfb display',
+                  default='16')
+    parser.addini('xvfb_args', 'Additional arguments for Xvfb',
+                  type='linelist')
+    parser.addini('xvfb_xauth',
+                  'Generate an Xauthority token for Xvfb. Needs xauth.',
+                  default=False, type='bool')
+
+
+def pytest_configure(config):
+    if config.getoption('--no-xvfb') or not xvfb_available():
+        config.xvfb = None
+        if (sys.platform.startswith('linux')
+                and 'DISPLAY' in os.environ
+                and not config.getoption('--no-xvfb')):
+            print('pytest-xvfb could not find Xvfb. '
+                  'You can install it to prevent windows from being shown.')
+    else:
+        config.xvfb = Xvfb(config)
+        config.xvfb.start()
+    config.addinivalue_line("markers", "no_xvfb: Skip test when using Xvfb")
+
+
+def pytest_unconfigure(config):
+    if getattr(config, 'xvfb', None) is not None:
+        config.xvfb.stop()
+
+
+def pytest_collection_modifyitems(items):
+    for item in items:
+        if item.get_marker('no_xvfb') and item.config.xvfb is not None:
+            skipif_marker = pytest.mark.skipif(
+                True, reason="Skipped with Xvfb")
+            item.add_marker(skipif_marker)
+
+
+ at pytest.fixture(scope='session')
+def xvfb(pytestconfig):
+    return pytestconfig.xvfb
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..861a9f5
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..6f994f3
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import codecs
+from setuptools import setup
+
+
+def read(fname):
+    file_path = os.path.join(os.path.dirname(__file__), fname)
+    return codecs.open(file_path, encoding='utf-8').read()
+
+
+setup(
+    name='pytest-xvfb',
+    version='1.0.0',
+    author='Florian Bruhin',
+    author_email='me at the-compiler.org',
+    maintainer='Florian Bruhin',
+    maintainer_email='me at the-compiler.org',
+    license='MIT',
+    url='https://github.com/The-Compiler/pytest-xvfb',
+    description='A pytest plugin to run Xvfb for tests.',
+    long_description=read('README.rst'),
+    py_modules=['pytest_xvfb'],
+    install_requires=['pytest>=2.8.1', 'pyvirtualdisplay>=0.2.1'],
+    classifiers=[
+        'Development Status :: 4 - Beta',
+        'Intended Audience :: Developers',
+        'Topic :: Software Development :: Testing',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: Implementation :: CPython',
+        'Programming Language :: Python :: Implementation :: PyPy',
+        'Operating System :: OS Independent',
+        'License :: OSI Approved :: MIT License',
+    ],
+    entry_points={
+        'pytest11': [
+            'xvfb = pytest_xvfb',
+        ],
+    },
+)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pytest-xvfb.git



More information about the Python-modules-commits mailing list