{ "info": { "author": "Dave Hunt", "author_email": "dhunt@mozilla.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", "Topic :: Utilities" ], "description": "pytest-base-url\n===============\n\npytest-base-url is a simple plugin for pytest_ that provides an optional base\nURL via the command line or configuration file.\n\n.. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg\n :target: https://github.com/pytest-dev/pytest-base-url/blob/master/LICENSE\n :alt: License\n.. image:: https://img.shields.io/pypi/v/pytest-base-url.svg\n :target: https://pypi.python.org/pypi/pytest-base-url/\n :alt: PyPI\n.. image:: https://img.shields.io/travis/pytest-dev/pytest-base-url.svg\n :target: https://travis-ci.org/pytest-dev/pytest-base-url/\n :alt: Travis\n.. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-base-url.svg\n :target: https://github.com/pytest-dev/pytest-base-url/issues\n :alt: Issues\n.. image:: https://img.shields.io/requires/github/pytest-dev/pytest-base-url.svg\n :target: https://requires.io/github/pytest-dev/pytest-base-url/requirements/?branch=master\n :alt: Requirements\n\nRequirements\n------------\n\nYou will need the following prerequisites in order to use pytest-base-url:\n\n- Python 2.7, 3.6, PyPy, or PyPy3\n- py.test 2.7 or newer\n\nInstallation\n------------\n\nTo install pytest-base-url:\n\n.. code-block:: bash\n\n $ pip install pytest-base-url\n\nSpecifying a Base URL\n---------------------\n\nRather than repeating or abstracting a base URL in your tests, pytest-base-url\nprovides a ``base_url`` fixture that returns the specified base URL.\n\n.. code-block:: python\n\n import urllib2\n\n def test_example(base_url):\n assert 200 == urllib2.urlopen(base_url).getcode()\n\nUsing the Command Line\n^^^^^^^^^^^^^^^^^^^^^^\n\nYou can specify the base URL on the command line:\n\n.. code-block:: bash\n\n $ py.test --base-url http://www.example.com\n\nUsing a Configuration File\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can specify the base URL using a `configuration file`_:\n\n.. code-block:: ini\n\n [pytest]\n base_url = http://www.example.com\n\nUsing an Environment Variable\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can specify the base URL by setting the ``PYTEST_BASE_URL`` environment variable.\n\nUsing a Fixture\n^^^^^^^^^^^^^^^\n\nIf your test harness takes care of launching an instance of your application\nunder test, you may not have a predictable base URL to provide on the command\nline. Fortunately, it's easy to override the ``base_url`` fixture and return\nthe correct URL to your test.\n\nIn the following example a ``live_server`` fixture is used to start the\napplication and ``live_server.url`` returns the base URL of the site.\n\n.. code-block:: python\n\n import urllib2\n import pytest\n\n @pytest.fixture\n def base_url(live_server):\n return live_server.url\n\n def test_search(base_url):\n assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode()\n\nAvailable Live Servers\n----------------------\n\nIt's relatively simple to create your own ``live_server`` fixture, however you\nmay be able to take advantage of one of the following:\n\n* Django applications can use pytest-django_'s ``live_server`` fixture.\n* Flask applications can use pytest-flask_'s ``live_server`` fixture.\n\nVerifying the Base URL\n----------------------\n\nIf you specify a base URL for a site that's unavailable then all tests using\nthat base URL will likely fail. To avoid running every test in this instance,\nyou can enable base URL verification. This will check the base URL is\nresponding before proceeding with the test suite. To enable this, specify the\n``--verify-base-url`` command line option or set the ``VERIFY_BASE_URL``\nenvironment variable to ``TRUE``.\n\nSkipping Base URLs\n------------------\n\nYou can `skip tests`_ based on the value of the base URL so long as it is\nprovided either by the command line or in a configuration file:\n\n.. code-block:: python\n\n import urllib2\n import pytest\n\n @pytest.mark.skipif(\n 'dev' in pytest.config.getoption('base_url'),\n reason='Search not available on dev')\n def test_search(base_url):\n assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode()\n\nUnfortunately if the URL is provided by a fixture, there is no way to know this\nvalue at test collection.\n\nResources\n---------\n\n- `Release Notes`_\n- `Issue Tracker`_\n- Code_\n\n.. _pytest: http://www.python.org/\n.. _configuration file: http://pytest.org/latest/customize.html#command-line-options-and-configuration-file-settings\n.. _pytest-django: http://pytest-django.readthedocs.org/\n.. _pytest-flask: http://pytest-flask.readthedocs.org/\n.. _skip tests: http://pytest.org/latest/skipping.html\n.. _Release Notes: http://github.com/pytest-dev/pytest-base-url/blob/master/CHANGES.rst\n.. _Issue Tracker: http://github.com/pytest-dev/pytest-base-url/issues\n.. _Code: http://github.com/pytest-dev/pytest-base-url", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pytest-dev/pytest-base-url", "keywords": "py.test pytest base url mozilla automation", "license": "Mozilla Public License 2.0 (MPL 2.0)", "maintainer": "", "maintainer_email": "", "name": "pytest-base-url", "package_url": "https://pypi.org/project/pytest-base-url/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pytest-base-url/", "project_urls": { "Homepage": "https://github.com/pytest-dev/pytest-base-url" }, "release_url": "https://pypi.org/project/pytest-base-url/1.4.1/", "requires_dist": [ "pytest (>=2.7.3)", "requests (>=2.9)" ], "requires_python": "", "summary": "pytest plugin for URL based testing", "version": "1.4.1" }, "last_serial": 2968015, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "c1cda0b2196e83e2af2ddde7955873ad", "sha256": "e7955cb9222f63774d11579bfa5bc5739448adc954646696784c2d973390868e" }, "downloads": -1, "filename": "pytest_base_url-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c1cda0b2196e83e2af2ddde7955873ad", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6884, "upload_time": "2016-05-10T13:23:57", "url": "https://files.pythonhosted.org/packages/d6/4b/bf3f02b82eba26a342b80e40afffc3eff44acefeab7161d6b563be262816/pytest_base_url-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ed7a472a2819664aadedb092bb7b606", "sha256": "5ffc137071d289dfb4c55403032ed81a83b7173495c58230f9a4cba59442e31c" }, "downloads": -1, "filename": "pytest-base-url-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1ed7a472a2819664aadedb092bb7b606", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4030, "upload_time": "2016-05-10T13:24:15", "url": "https://files.pythonhosted.org/packages/44/a2/3bbeff1137c4791f11247e39d4ff1b7f54735d76eddc3f20f0cb93f145c6/pytest-base-url-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "2d309208a5ae697c56bf815d180b7e16", "sha256": "001c1b2678dae82c2891db415251361b29ed6824cb2085e4821635119499071e" }, "downloads": -1, "filename": "pytest_base_url-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2d309208a5ae697c56bf815d180b7e16", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7019, "upload_time": "2016-07-07T14:05:59", "url": "https://files.pythonhosted.org/packages/bf/21/618d5f9cac232fe574908638aedd73ec3205de6f343ea10c94fd0025628e/pytest_base_url-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edfb6c8797cfa5a58fd1fc5b677f46b3", "sha256": "90a1ce6a00a558231117b5aee32300edecbc0c2fd701c13e8cec62177900d28c" }, "downloads": -1, "filename": "pytest-base-url-1.1.0.tar.gz", "has_sig": false, "md5_digest": "edfb6c8797cfa5a58fd1fc5b677f46b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4118, "upload_time": "2016-07-07T14:09:50", "url": "https://files.pythonhosted.org/packages/26/72/13d09fca6e5ad4ee263aaff01a662105646036135d8f8989b965f6a10274/pytest-base-url-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "fad42b42c5885174a0a70ee9e74e6252", "sha256": "248dae2e3e7bb2c69d10101724b68fe756853e4ece4d9feb8bf09b38c027f65b" }, "downloads": -1, "filename": "pytest_base_url-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fad42b42c5885174a0a70ee9e74e6252", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7100, "upload_time": "2016-11-17T21:11:37", "url": "https://files.pythonhosted.org/packages/97/53/53d6ca1f8a1653724f5797f60e927f06ef470c4d1c8060eb93fc9b4e4919/pytest_base_url-1.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "307d850e67940e6fc501b20908022006", "sha256": "cbb117787d7327dde0d50b9b9be4203a831986ec0dc658317815bbd24a039ca9" }, "downloads": -1, "filename": "pytest-base-url-1.2.0.tar.gz", "has_sig": false, "md5_digest": "307d850e67940e6fc501b20908022006", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6968, "upload_time": "2016-11-17T21:11:39", "url": "https://files.pythonhosted.org/packages/c2/22/81ada8a26af506fd9aa57adab50bf1553cbe013a6555bd5161c8745a9304/pytest-base-url-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "03f3fbef233eacf0a5fc1e8033b7109a", "sha256": "3e1d40d2826c2d848b31355502815250ad4035e5bfb4e3ad0405b2d6fad874f4" }, "downloads": -1, "filename": "pytest_base_url-1.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "03f3fbef233eacf0a5fc1e8033b7109a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7072, "upload_time": "2017-02-27T15:53:36", "url": "https://files.pythonhosted.org/packages/34/b2/ee5be64bc31c333acd222541400b3524c7ff23e3d395b69ab23a50e0bf61/pytest_base_url-1.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c3e530db35c8bbbb9b950eebb3a0251", "sha256": "e3018b3739a19e66be19c6bfe77d7814acd79a5ca0cab2730fa2d2f483cc7397" }, "downloads": -1, "filename": "pytest-base-url-1.3.0.tar.gz", "has_sig": false, "md5_digest": "8c3e530db35c8bbbb9b950eebb3a0251", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6994, "upload_time": "2017-02-27T15:53:37", "url": "https://files.pythonhosted.org/packages/09/82/611656797089b64acc187bea10250d9c02f60f57555fba670ffb86b1e0f4/pytest-base-url-1.3.0.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "2a0983a3e877d661d154de5505e74486", "sha256": "580f010db979cb412fefdbe4b4e3978f30bbd726e4c2ff911c63bf4d06936a69" }, "downloads": -1, "filename": "pytest_base_url-1.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2a0983a3e877d661d154de5505e74486", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7099, "upload_time": "2017-06-12T22:06:01", "url": "https://files.pythonhosted.org/packages/5f/57/487ee64891851675e90e607353d0cb4b56d7a3ef77eda0a42b64cca3ae72/pytest_base_url-1.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1c44a4a96779849319378a1c81b2bf35", "sha256": "9f5f0c15ed3854d97938e203776403921e48e9ae2e392c44958020675a375884" }, "downloads": -1, "filename": "pytest-base-url-1.4.0.tar.gz", "has_sig": false, "md5_digest": "1c44a4a96779849319378a1c81b2bf35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7201, "upload_time": "2017-06-12T22:06:02", "url": "https://files.pythonhosted.org/packages/d5/75/8689668aceb8b22261fef444637aa3119a3eb735696d25be8f535dbb9bd0/pytest-base-url-1.4.0.tar.gz" } ], "1.4.1": [ { "comment_text": "", "digests": { "md5": "581cce1088bc6d7da44050f8412793f8", "sha256": "31e42366a5fc22f450b398837dc819bb7569f5e6bd5d74e494b2b9ec239876d1" }, "downloads": -1, "filename": "pytest_base_url-1.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "581cce1088bc6d7da44050f8412793f8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7085, "upload_time": "2017-06-22T13:00:24", "url": "https://files.pythonhosted.org/packages/f4/2e/e2001eb40c88a66ebca4db017358bc47d1fd87dec895a7ec8c3103498437/pytest_base_url-1.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ed48667c8d23ba611331e5d5b144d704", "sha256": "7425e8163345494ac7f544e99c6f3e5a08f4228bee5e26013b98c462a4d31f6e" }, "downloads": -1, "filename": "pytest-base-url-1.4.1.tar.gz", "has_sig": false, "md5_digest": "ed48667c8d23ba611331e5d5b144d704", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7082, "upload_time": "2017-06-22T13:00:25", "url": "https://files.pythonhosted.org/packages/cd/c1/a66ccb7801139f79084c04711b8ae17f4318fe52f68929b59ec906cd0e52/pytest-base-url-1.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "581cce1088bc6d7da44050f8412793f8", "sha256": "31e42366a5fc22f450b398837dc819bb7569f5e6bd5d74e494b2b9ec239876d1" }, "downloads": -1, "filename": "pytest_base_url-1.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "581cce1088bc6d7da44050f8412793f8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7085, "upload_time": "2017-06-22T13:00:24", "url": "https://files.pythonhosted.org/packages/f4/2e/e2001eb40c88a66ebca4db017358bc47d1fd87dec895a7ec8c3103498437/pytest_base_url-1.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ed48667c8d23ba611331e5d5b144d704", "sha256": "7425e8163345494ac7f544e99c6f3e5a08f4228bee5e26013b98c462a4d31f6e" }, "downloads": -1, "filename": "pytest-base-url-1.4.1.tar.gz", "has_sig": false, "md5_digest": "ed48667c8d23ba611331e5d5b144d704", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7082, "upload_time": "2017-06-22T13:00:25", "url": "https://files.pythonhosted.org/packages/cd/c1/a66ccb7801139f79084c04711b8ae17f4318fe52f68929b59ec906cd0e52/pytest-base-url-1.4.1.tar.gz" } ] }