xvfbwrapper


Namexvfbwrapper JSON
Version 0.2.9 PyPI version JSON
download
home_pagehttps://github.com/cgoldberg/xvfbwrapper
Summaryrun headless display inside X virtual framebuffer (Xvfb)
upload_time2016-12-17 20:50:38
maintainerNone
docs_urlNone
authorCorey Goldberg
requires_pythonNone
licenseMIT
keywords xvfb virtual display headless x11
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ===============
    xvfbwrapper
===============


**Manage headless displays with Xvfb (X virtual framebuffer)**

.. image:: https://travis-ci.org/cgoldberg/xvfbwrapper.svg?branch=master
    :target: https://travis-ci.org/cgoldberg/xvfbwrapper

----

---------
    Info:
---------

- Dev: https://github.com/cgoldberg/xvfbwrapper
- Releases: https://pypi.python.org/pypi/xvfbwrapper
- Author: `Corey Goldberg <https://github.com/cgoldberg>`_ - 2012-2016
- License: MIT

----

----------------------
    About xvfbwrapper:
----------------------

xvfbwrapper is a python wrapper for controlling Xvfb.

----

---------------
    About Xvfb:
---------------

Xvfb (X virtual framebuffer) is a display server implementing the X11 display server protocol. It runs in memory and does not require a physical display.  Only a network layer is necessary.

Xvfb is especially useful for running acceptance tests on headless servers.

----


----------------------------------
    Install xvfbwrapper from PyPI:
----------------------------------

  ``pip install xvfbwrapper``

----

------------------------
    System Requirements:
------------------------

* Xvfb (``sudo apt-get install xvfb``, or similar)
* Python 2.7 or 3.3+

----

++++++++++++
    Examples
++++++++++++

****************
    Basic Usage:
****************

::

    from xvfbwrapper import Xvfb

    vdisplay = Xvfb()
    vdisplay.start()

    # launch stuff inside
    # virtual display here.

    vdisplay.stop()

----

*********************************************
    Basic Usage, specifying display geometry:
*********************************************

::

    from xvfbwrapper import Xvfb

    vdisplay = Xvfb(width=1280, height=740, colordepth=16)
    vdisplay.start()

    # launch stuff inside
    # virtual display here.

    vdisplay.stop()

----

*******************************
    Usage as a Context Manager:
*******************************

::

    from xvfbwrapper import Xvfb

    with Xvfb() as xvfb:
        # launch stuff inside virtual display here.
        # It starts/stops around this code block.

----

*******************************************************
    Testing Example: Headless Selenium WebDriver Tests:
*******************************************************

::

    import unittest

    from selenium import webdriver
    from xvfbwrapper import Xvfb


    class TestPages(unittest.TestCase):

        def setUp(self):
            self.xvfb = Xvfb(width=1280, height=720)
            self.addCleanup(self.xvfb.stop)
            self.xvfb.start()
            self.browser = webdriver.Firefox()
            self.addCleanup(self.browser.quit)

        def testUbuntuHomepage(self):
            self.browser.get('http://www.ubuntu.com')
            self.assertIn('Ubuntu', self.browser.title)

        def testGoogleHomepage(self):
            self.browser.get('http://www.google.com')
            self.assertIn('Google', self.browser.title)


    if __name__ == '__main__':
        unittest.main()


The test class above uses `selenium` and `xvfbwrapper` to run each test case with Firefox inside a headless display.

* virtual display is launched
* Firefox launches inside virtual display (headless)
* browser is not shown while tests are run
* conditions are asserted in each test case
* browser quits during cleanup
* virtual display stops during cleanup

*Look Ma', no browser!*

(You can also take screenshots inside the virtual display for diagnosing test failures)
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cgoldberg/xvfbwrapper",
    "name": "xvfbwrapper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "xvfb,virtual,display,headless,x11",
    "author": "Corey Goldberg",
    "author_email": "cgoldberg _at_ gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/57/b6/4920eabda9b49630dea58745e79f9919aba6408d460afe758bf6e9b21a04/xvfbwrapper-0.2.9.tar.gz",
    "platform": "UNKNOWN",
    "description": "===============\n    xvfbwrapper\n===============\n\n\n**Manage headless displays with Xvfb (X virtual framebuffer)**\n\n.. image:: https://travis-ci.org/cgoldberg/xvfbwrapper.svg?branch=master\n    :target: https://travis-ci.org/cgoldberg/xvfbwrapper\n\n----\n\n---------\n    Info:\n---------\n\n- Dev: https://github.com/cgoldberg/xvfbwrapper\n- Releases: https://pypi.python.org/pypi/xvfbwrapper\n- Author: `Corey Goldberg <https://github.com/cgoldberg>`_ - 2012-2016\n- License: MIT\n\n----\n\n----------------------\n    About xvfbwrapper:\n----------------------\n\nxvfbwrapper is a python wrapper for controlling Xvfb.\n\n----\n\n---------------\n    About Xvfb:\n---------------\n\nXvfb (X virtual framebuffer) is a display server implementing the X11 display server protocol. It runs in memory and does not require a physical display.  Only a network layer is necessary.\n\nXvfb is especially useful for running acceptance tests on headless servers.\n\n----\n\n\n----------------------------------\n    Install xvfbwrapper from PyPI:\n----------------------------------\n\n  ``pip install xvfbwrapper``\n\n----\n\n------------------------\n    System Requirements:\n------------------------\n\n* Xvfb (``sudo apt-get install xvfb``, or similar)\n* Python 2.7 or 3.3+\n\n----\n\n++++++++++++\n    Examples\n++++++++++++\n\n****************\n    Basic Usage:\n****************\n\n::\n\n    from xvfbwrapper import Xvfb\n\n    vdisplay = Xvfb()\n    vdisplay.start()\n\n    # launch stuff inside\n    # virtual display here.\n\n    vdisplay.stop()\n\n----\n\n*********************************************\n    Basic Usage, specifying display geometry:\n*********************************************\n\n::\n\n    from xvfbwrapper import Xvfb\n\n    vdisplay = Xvfb(width=1280, height=740, colordepth=16)\n    vdisplay.start()\n\n    # launch stuff inside\n    # virtual display here.\n\n    vdisplay.stop()\n\n----\n\n*******************************\n    Usage as a Context Manager:\n*******************************\n\n::\n\n    from xvfbwrapper import Xvfb\n\n    with Xvfb() as xvfb:\n        # launch stuff inside virtual display here.\n        # It starts/stops around this code block.\n\n----\n\n*******************************************************\n    Testing Example: Headless Selenium WebDriver Tests:\n*******************************************************\n\n::\n\n    import unittest\n\n    from selenium import webdriver\n    from xvfbwrapper import Xvfb\n\n\n    class TestPages(unittest.TestCase):\n\n        def setUp(self):\n            self.xvfb = Xvfb(width=1280, height=720)\n            self.addCleanup(self.xvfb.stop)\n            self.xvfb.start()\n            self.browser = webdriver.Firefox()\n            self.addCleanup(self.browser.quit)\n\n        def testUbuntuHomepage(self):\n            self.browser.get('http://www.ubuntu.com')\n            self.assertIn('Ubuntu', self.browser.title)\n\n        def testGoogleHomepage(self):\n            self.browser.get('http://www.google.com')\n            self.assertIn('Google', self.browser.title)\n\n\n    if __name__ == '__main__':\n        unittest.main()\n\n\nThe test class above uses `selenium` and `xvfbwrapper` to run each test case with Firefox inside a headless display.\n\n* virtual display is launched\n* Firefox launches inside virtual display (headless)\n* browser is not shown while tests are run\n* conditions are asserted in each test case\n* browser quits during cleanup\n* virtual display stops during cleanup\n\n*Look Ma', no browser!*\n\n(You can also take screenshots inside the virtual display for diagnosing test failures)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "run headless display inside X virtual framebuffer (Xvfb)",
    "version": "0.2.9",
    "split_keywords": [
        "xvfb",
        "virtual",
        "display",
        "headless",
        "x11"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "3f3cbed698606f4b14e76ccc7b5dd366",
                "sha256": "bcf4ae571941b40254faf7a73432dfc119ad21ce688f1fdec533067037ecfc24"
            },
            "downloads": -1,
            "filename": "xvfbwrapper-0.2.9.tar.gz",
            "has_sig": false,
            "md5_digest": "3f3cbed698606f4b14e76ccc7b5dd366",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5575,
            "upload_time": "2016-12-17T20:50:38",
            "upload_time_iso_8601": "2016-12-17T20:50:38.431417Z",
            "url": "https://files.pythonhosted.org/packages/57/b6/4920eabda9b49630dea58745e79f9919aba6408d460afe758bf6e9b21a04/xvfbwrapper-0.2.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2016-12-17 20:50:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "cgoldberg",
    "github_project": "xvfbwrapper",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "xvfbwrapper"
}
        
Elapsed time: 0.05494s