Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-base-url for openSUSE:Factory checked in at 2022-04-30 00:46:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-base-url (Old) and /work/SRC/openSUSE:Factory/.python-pytest-base-url.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-base-url" Sat Apr 30 00:46:21 2022 rev:2 rq:973966 version:2.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-base-url/python-pytest-base-url.changes 2020-10-06 17:16:29.041804431 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-base-url.new.1538/python-pytest-base-url.changes 2022-04-30 00:46:52.979021391 +0200 @@ -1,0 +2,7 @@ +Fri Apr 29 10:14:27 UTC 2022 - Mark??ta Machov?? <mmach...@suse.com> + +- Update to 2.0.0 + * Drop python 2.7 and 3.6 support + * Switch to pyproject.toml and Poetry + +------------------------------------------------------------------- Old: ---- pytest-base-url-1.4.2.tar.gz New: ---- pytest-base-url-2.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-base-url.spec ++++++ --- /var/tmp/diff_new_pack.kQRlLf/_old 2022-04-30 00:46:53.415021769 +0200 +++ /var/tmp/diff_new_pack.kQRlLf/_new 2022-04-30 00:46:53.419021772 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-pytest-base-url # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,24 +16,25 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} Name: python-pytest-base-url -Version: 1.4.2 +Version: 2.0.0 Release: 0 Summary: Pytest plugin for URL based testing License: MPL-2.0 Group: Development/Languages/Python URL: https://github.com/pytest-dev/pytest-base-url Source: https://files.pythonhosted.org/packages/source/p/pytest-base-url/pytest-base-url-%{version}.tar.gz -BuildRequires: %{python_module setuptools_scm} -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module poetry-core} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-pytest >= 2.7.3 +Requires: python-pytest >= 3.0.0 Requires: python-requests >= 2.9 BuildArch: noarch # SECTION test requirements -BuildRequires: %{python_module pytest >= 2.7.3} +BuildRequires: %{python_module pytest >= 3.0.0} BuildRequires: %{python_module pytest-localserver} BuildRequires: %{python_module requests >= 2.9} # /SECTION @@ -46,17 +47,17 @@ %setup -q -n pytest-base-url-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check %pytest %files %{python_files} -%doc CHANGES.rst README.rst +%doc README.rst %license LICENSE %{python_sitelib}/* ++++++ pytest-base-url-1.4.2.tar.gz -> pytest-base-url-2.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/.gitignore new/pytest-base-url-2.0.0/.gitignore --- old/pytest-base-url-1.4.2/.gitignore 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -__pycache__ -*.egg-info/ -*.pyc -.cache -.DS_Store -.tox -.eggs -.vscode/ -build -dist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/.pre-commit-config.yaml new/pytest-base-url-2.0.0/.pre-commit-config.yaml --- old/pytest-base-url-1.4.2/.pre-commit-config.yaml 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/.pre-commit-config.yaml 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -repos: - -- repo: https://github.com/psf/black - rev: stable - hooks: - - id: black - args: [--safe, --quiet] - language_version: python3 - -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.7 - hooks: - - id: flake8 - exclude: docs - language_version: python3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/.travis.yml new/pytest-base-url-2.0.0/.travis.yml --- old/pytest-base-url-1.4.2/.travis.yml 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,53 +0,0 @@ -language: python -jobs: - include: - - stage: Tests - name: Linting - python: 3.7 - dist: xenial - sudo: required - env: TOXENV=linting - - - - python: 2.7 - env: TOXENV=py27 - - - - python: 3.6 - env: TOXENV=py36 - - - - python: 3.7 - dist: xenial - sudo: required - env: TOXENV=py37 - - - - python: pypy - env: TOXENV=pypy - - - - python: pypy3 - env: TOXENV=pypy3 - - - stage: deploy - python: 3.7 - dist: xenial - sudo: required - install: skip - script: skip - deploy: - provider: pypi - user: davehunt - password: - secure: "aSevNdJQLPH1S1TNaI+uSFdiZ+dEQkkvmLym5eA8vjvo0fV4FEQfjZg8rW69hfYAGA4EFkE3hQUs5IQIm5ug+A3FsMDjom4nAhCthq8g/5hviT+V6wVzoVdxf0JhlpLtDFteFTOKj5Z9PC/xhJJ/2/JrzmEwUwopiNtSNBdVwRXCOvb6L3aIU5DmTtuWokpBNmv4H2cdjCxwLROSlKdfFr4urUwiOst/A5W1HvdxWhEkQL7fLx/sUOHobYjkoL32miTpSHUJNH1L0G8uciMdtXTBY3HQ/uRfWaDs3iJ7Iwtk2hEB1ukPZiXtBX0FjTJXd71a4BvvG1FSQgeQ4zW1Fzf8Xz5qg0Z1Z+7DTFzekhd1AfcwDlr2Vh7xD6FCBSjFyAIXQ0n36mtoEfHDM6RQMQSQZm4j+4EOdFf9kfWsTn9XGWCr47r3qe+6SUzGSvHcD6LeoZZ2ZJjSk37vdQ0y28yvZr5goBFwY11MMjMVqLSA4mWhhueBWA7il9ciwfJbb6RThBfnHYdT8l4NRztkXz6QaW4KCJNVr3aE3MwPLzfux9JUUml//JUjuhChLpEvrAM6CRliZSawKdE9E2o5QOISt7yiEVdaxohAcfTkj5X+WTS5QBYjT/8+iV6KWDjghm/FH13/WZlcqMfC7be+EgXvqv3ffUanX7jnpzdg1sQ=" - distributions: sdist bdist_wheel - on: - tags: true - repo: pytest-dev/pytest-base-url - -cache: pip - -install: pip install tox - -script: tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/CHANGES.rst new/pytest-base-url-2.0.0/CHANGES.rst --- old/pytest-base-url-1.4.2/CHANGES.rst 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/CHANGES.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -Release Notes -------------- - -**1.4.2 (2020-06-20)** - -* Lazy load requests dependency to reduce cost - - * Thanks to `@boxed <https://github.com/boxed>`_ for the PR - -* Fixed compatibility with ``pytest-xdist`` 2.0+ (supporting >= 1.22.3) - - * Thanks to `@Zac-HD <https://github.com/Zac-HD>`_ for the PR - -**1.4.1 (2017-06-22)** - -* Update dependency of requests to require v2.9 or later. - -**1.4.0 (2017-06-12)** - -* Add verify base URL timeouts - - * Thanks to `@jrbenny35 <https://github.com/jrbenny35>`_ for the PR - -**1.3.0 (2017-02-27)** - -* Add base URL to metadata provided by - `pytest-metadata <https://pypi.python.org/pypi/pytest-metadata/>`_. - -**1.2.0 (2016-11-17)** - -* Added support for specifying the base URL by environment variable - - * Thanks to `@m8ttyB <https://github.com/m8ttyB>`_ for the PR - -**1.1.0 (2016-07-07)** - -* Added base URL to report header - -**1.0.0 (2016-05-10)** - -* Initial release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/PKG-INFO new/pytest-base-url-2.0.0/PKG-INFO --- old/pytest-base-url-1.4.2/PKG-INFO 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/PKG-INFO 2022-03-27 15:22:04.278767000 +0200 @@ -1,186 +1,190 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: pytest-base-url -Version: 1.4.2 +Version: 2.0.0 Summary: pytest plugin for URL based testing Home-page: https://github.com/pytest-dev/pytest-base-url +License: MPL-2.0 +Keywords: pytest,base,url,mozilla,automation Author: Dave Hunt Author-email: dh...@mozilla.com -License: Mozilla Public License 2.0 (MPL 2.0) -Description: pytest-base-url - =============== - - pytest-base-url is a simple plugin for pytest_ that provides an optional base - URL via the command line or configuration file. - - .. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg - :target: https://github.com/pytest-dev/pytest-base-url/blob/master/LICENSE - :alt: License - .. image:: https://img.shields.io/pypi/v/pytest-base-url.svg - :target: https://pypi.python.org/pypi/pytest-base-url/ - :alt: PyPI - .. image:: https://img.shields.io/travis/pytest-dev/pytest-base-url.svg - :target: https://travis-ci.org/pytest-dev/pytest-base-url/ - :alt: Travis - .. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-base-url.svg - :target: https://github.com/pytest-dev/pytest-base-url/issues - :alt: Issues - .. image:: https://img.shields.io/requires/github/pytest-dev/pytest-base-url.svg - :target: https://requires.io/github/pytest-dev/pytest-base-url/requirements/?branch=master - :alt: Requirements - - Requirements - ------------ - - You will need the following prerequisites in order to use pytest-base-url: - - - Python 2.7, 3.6, PyPy, or PyPy3 - - py.test 2.7 or newer - - Installation - ------------ - - To install pytest-base-url: - - .. code-block:: bash - - $ pip install pytest-base-url - - Contributing - ------------ - - We welcome contributions. - - To learn more, see `Development <https://github.com/pytest-dev/pytest-base-url/blob/master/development.rst>`_ - - Specifying a Base URL - --------------------- - - Rather than repeating or abstracting a base URL in your tests, pytest-base-url - provides a ``base_url`` fixture that returns the specified base URL. - - .. code-block:: python - - import urllib2 - - def test_example(base_url): - assert 200 == urllib2.urlopen(base_url).getcode() - - Using the Command Line - ^^^^^^^^^^^^^^^^^^^^^^ - - You can specify the base URL on the command line: - - .. code-block:: bash - - $ py.test --base-url http://www.example.com - - Using a Configuration File - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - - You can specify the base URL using a `configuration file`_: - - .. code-block:: ini - - [pytest] - base_url = http://www.example.com - - Using an Environment Variable - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - You can specify the base URL by setting the ``PYTEST_BASE_URL`` environment variable. - - Using a Fixture - ^^^^^^^^^^^^^^^ - - If your test harness takes care of launching an instance of your application - under test, you may not have a predictable base URL to provide on the command - line. Fortunately, it's easy to override the ``base_url`` fixture and return - the correct URL to your test. - - In the following example a ``live_server`` fixture is used to start the - application and ``live_server.url`` returns the base URL of the site. - - .. code-block:: python - - import urllib2 - import pytest - - @pytest.fixture - def base_url(live_server): - return live_server.url - - def test_search(base_url): - assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode() - - Available Live Servers - ---------------------- - - It's relatively simple to create your own ``live_server`` fixture, however you - may be able to take advantage of one of the following: - - * Django applications can use pytest-django_'s ``live_server`` fixture. - * Flask applications can use pytest-flask_'s ``live_server`` fixture. - - Verifying the Base URL - ---------------------- - - If you specify a base URL for a site that's unavailable then all tests using - that base URL will likely fail. To avoid running every test in this instance, - you can enable base URL verification. This will check the base URL is - responding before proceeding with the test suite. To enable this, specify the - ``--verify-base-url`` command line option or set the ``VERIFY_BASE_URL`` - environment variable to ``TRUE``. - - Skipping Base URLs - ------------------ - - You can `skip tests`_ based on the value of the base URL so long as it is - provided either by the command line or in a configuration file: - - .. code-block:: python - - import urllib2 - import pytest - - @pytest.mark.skipif( - "'dev' in config.getoption('base_url')", - reason='Search not available on dev') - def test_search(base_url): - assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode() - - Unfortunately if the URL is provided by a fixture, there is no way to know this - value at test collection. - - Resources - --------- - - - `Release Notes`_ - - `Issue Tracker`_ - - Code_ - - .. _pytest: http://www.python.org/ - .. _configuration file: http://pytest.org/latest/customize.html#command-line-options-and-configuration-file-settings - .. _pytest-django: http://pytest-django.readthedocs.org/ - .. _pytest-flask: http://pytest-flask.readthedocs.org/ - .. _skip tests: http://pytest.org/latest/skipping.html - .. _Release Notes: http://github.com/pytest-dev/pytest-base-url/blob/master/CHANGES.rst - .. _Issue Tracker: http://github.com/pytest-dev/pytest-base-url/issues - .. _Code: http://github.com/pytest-dev/pytest-base-url - -Keywords: py.test pytest base url mozilla automation -Platform: UNKNOWN +Requires-Python: >=3.7,<4.0 Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: Pytest Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) -Classifier: Operating System :: POSIX -Classifier: Operating System :: Microsoft :: Windows +Classifier: License :: OSI Approved Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Topic :: Software Development :: Quality Assurance Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy +Requires-Dist: pytest (>=3.0.0,<8.0.0) +Requires-Dist: requests (>=2.9) +Project-URL: Repository, https://github.com/pytest-dev/pytest-base-url +Description-Content-Type: text/x-rst + +pytest-base-url +=============== + +pytest-base-url is a simple plugin for pytest_ that provides an optional base +URL via the command line or configuration file. + +.. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg + :target: https://github.com/pytest-dev/pytest-base-url/blob/master/LICENSE + :alt: License +.. image:: https://img.shields.io/pypi/v/pytest-base-url.svg + :target: https://pypi.python.org/pypi/pytest-base-url/ + :alt: PyPI +.. image:: https://img.shields.io/travis/pytest-dev/pytest-base-url.svg + :target: https://travis-ci.org/pytest-dev/pytest-base-url/ + :alt: Travis +.. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-base-url.svg + :target: https://github.com/pytest-dev/pytest-base-url/issues + :alt: Issues +.. image:: https://img.shields.io/requires/github/pytest-dev/pytest-base-url.svg + :target: https://requires.io/github/pytest-dev/pytest-base-url/requirements/?branch=master + :alt: Requirements + +Requirements +------------ + +You will need the following prerequisites in order to use pytest-base-url: + +- Python 3.7+ or PyPy3 + +Installation +------------ + +To install pytest-base-url: + +.. code-block:: bash + + $ pip install pytest-base-url + +Contributing +------------ + +We welcome contributions. + +To learn more, see `Development <https://github.com/pytest-dev/pytest-base-url/blob/master/development.rst>`_ + +Specifying a Base URL +--------------------- + +Rather than repeating or abstracting a base URL in your tests, pytest-base-url +provides a ``base_url`` fixture that returns the specified base URL. + +.. code-block:: python + + import urllib2 + + def test_example(base_url): + assert 200 == urllib2.urlopen(base_url).getcode() + +Using the Command Line +^^^^^^^^^^^^^^^^^^^^^^ + +You can specify the base URL on the command line: + +.. code-block:: bash + + $ py.test --base-url http://www.example.com + +Using a Configuration File +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can specify the base URL using a `configuration file`_: + +.. code-block:: ini + + [pytest] + base_url = http://www.example.com + +Using an Environment Variable +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can specify the base URL by setting the ``PYTEST_BASE_URL`` environment variable. + +Using a Fixture +^^^^^^^^^^^^^^^ + +If your test harness takes care of launching an instance of your application +under test, you may not have a predictable base URL to provide on the command +line. Fortunately, it's easy to override the ``base_url`` fixture and return +the correct URL to your test. + +In the following example a ``live_server`` fixture is used to start the +application and ``live_server.url`` returns the base URL of the site. + +.. code-block:: python + + import urllib2 + import pytest + + @pytest.fixture + def base_url(live_server): + return live_server.url + + def test_search(base_url): + assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode() + +Available Live Servers +---------------------- + +It's relatively simple to create your own ``live_server`` fixture, however you +may be able to take advantage of one of the following: + +* Django applications can use pytest-django_'s ``live_server`` fixture. +* Flask applications can use pytest-flask_'s ``live_server`` fixture. + +Verifying the Base URL +---------------------- + +If you specify a base URL for a site that's unavailable then all tests using +that base URL will likely fail. To avoid running every test in this instance, +you can enable base URL verification. This will check the base URL is +responding before proceeding with the test suite. To enable this, specify the +``--verify-base-url`` command line option or set the ``VERIFY_BASE_URL`` +environment variable to ``TRUE``. + +Skipping Base URLs +------------------ + +You can `skip tests`_ based on the value of the base URL so long as it is +provided either by the command line or in a configuration file: + +.. code-block:: python + + import urllib2 + import pytest + + @pytest.mark.skipif( + "'dev' in config.getoption('base_url')", + reason='Search not available on dev') + def test_search(base_url): + assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode() + +Unfortunately if the URL is provided by a fixture, there is no way to know this +value at test collection. + +Resources +--------- + +- `Release Notes`_ +- `Issue Tracker`_ +- Code_ + +.. _pytest: http://www.python.org/ +.. _configuration file: http://pytest.org/latest/customize.html#command-line-options-and-configuration-file-settings +.. _pytest-django: http://pytest-django.readthedocs.org/ +.. _pytest-flask: http://pytest-flask.readthedocs.org/ +.. _skip tests: http://pytest.org/latest/skipping.html +.. _Release Notes: http://github.com/pytest-dev/pytest-base-url/blob/master/CHANGES.rst +.. _Issue Tracker: http://github.com/pytest-dev/pytest-base-url/issues +.. _Code: http://github.com/pytest-dev/pytest-base-url + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/Pipfile new/pytest-base-url-2.0.0/Pipfile --- old/pytest-base-url-1.4.2/Pipfile 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/Pipfile 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -pytest = "*" -tox = "*" -flake8 = "*" -black = "*" -pre-commit = "*" - -[packages] -pytest-base-url = {editable = true,path = "."} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/README.rst new/pytest-base-url-2.0.0/README.rst --- old/pytest-base-url-1.4.2/README.rst 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/README.rst 2022-03-27 15:21:27.015980200 +0200 @@ -25,8 +25,7 @@ You will need the following prerequisites in order to use pytest-base-url: -- Python 2.7, 3.6, PyPy, or PyPy3 -- py.test 2.7 or newer +- Python 3.7+ or PyPy3 Installation ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/development.rst new/pytest-base-url-2.0.0/development.rst --- old/pytest-base-url-1.4.2/development.rst 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/development.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,70 +0,0 @@ -Development -=========== - -To contribute to `pytest-base-url` you can use `Pipenv`_ to manage -a python virtual environment and `pre-commit <https://pre-commit.com/>`_ to help you with -styling and formatting. - -To setup the virtual environment and pre-commit, run: - -.. code-block:: bash - - $ pipenv install --dev - $ pipenv run pre-commit install - -If you're not using `Pipenv`_, to install `pre-commit`, run: - -.. code-block:: bash - - $ pip install pre-commit - $ pre-commit install - - -Automated Testing ------------------ - -All pull requests and merges are tested in `Travis CI <https://travis-ci.org/>`_ -based on the ``.travis.yml`` file. - -Usually, a link to your specific travis build appears in pull requests, but if -not, you can find it on the -`pull requests page <https://travis-ci.org/pytest-dev/pytest-base-url/pull_requests>`_ - -The only way to trigger Travis CI to run again for a pull request, is to submit -another change to the pull branch. - -You can do this with `git commit --allow-empty` - -Running Tests -------------- - -You will need `Tox <http://tox.testrun.org/>`_ installed to run the tests -against the supported Python versions. If you're using `Pipenv`_ it will be -installed for you. - -With `Pipenv`_, run: - -.. code-block:: bash - - $ pipenv run tox - -Otherwise, to install and run, do: - -.. code-block:: bash - - $ pip install tox - $ tox - -Releasing a new version ------------------------ - -Follow these steps to release a new version of the project: - -1. Update your local master with the upstream master (``git pull --rebase upstream master``) -2. Create a new branch and update ``CHANGES.rst`` with the new version, today's date, and all changes/new features -3. Commit and push the new branch and then create a new pull request -4. Wait for tests and reviews and then merge the branch -5. Once merged, update your local master again (``git pull --rebase upstream master``) -6. Tag the release with the new release version (``git tag v<new tag>``) -7. Push the tag (``git push upstream --tags``) -8. Done. You can monitor the progress on `Travis <https://travis-ci.org/pytest-dev/pytest-base-url/>`_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pyproject.toml new/pytest-base-url-2.0.0/pyproject.toml --- old/pytest-base-url-1.4.2/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-base-url-2.0.0/pyproject.toml 2022-03-27 15:21:27.019980400 +0200 @@ -0,0 +1,57 @@ +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "pytest-base-url" +version = "2.0.0" +description = "pytest plugin for URL based testing" +license = "MPL-2.0" +authors = [ + "Dave Hunt <dh...@mozilla.com>", + "Jim Br??nnlund <jimbrannl...@fastmail.com>" +] +readme = "README.rst" +homepage = "https://github.com/pytest-dev/pytest-base-url" +repository = "https://github.com/pytest-dev/pytest-base-url" +keywords = [ + "pytest", + "base", + "url", + "mozilla", + "automation" +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Pytest", + "Intended Audience :: Developers", + "Operating System :: POSIX", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS :: MacOS X", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", + "Topic :: Utilities", +] +packages = [ + { include = "pytest_base_url", from = "src" }, +] +include = [ + { path = "tests", format = "sdist" }, +] + +[tool.poetry.dependencies] +python = "^3.7" +pytest = ">=3.0.0,<8.0.0" +requests = ">=2.9" + +[tool.poetry.dev-dependencies] +black = "^22.1.0" +flake8 = "^4.0.1" +tox = "^3.24.5" +pre-commit = "^2.17.0" + +[tool.poetry.plugins.pytest11] +base_url = 'pytest_base_url.plugin' + +[tool.black] +target-version = ['py37'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pytest_base_url/plugin.py new/pytest-base-url-2.0.0/pytest_base_url/plugin.py --- old/pytest-base-url-1.4.2/pytest_base_url/plugin.py 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/pytest_base_url/plugin.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,65 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os - -import pytest - - -@pytest.fixture(scope="session") -def base_url(request): - """Return a base URL""" - config = request.config - base_url = config.getoption("base_url") - if base_url is not None: - return base_url - - -@pytest.fixture(scope="session", autouse=True) -def _verify_url(request, base_url): - """Verifies the base URL""" - - verify = request.config.option.verify_base_url - if base_url and verify: - # Lazy load requests to reduce cost for tests that don't use the plugin - import requests - from requests.packages.urllib3.util.retry import Retry - from requests.adapters import HTTPAdapter - - session = requests.Session() - retries = Retry(backoff_factor=0.1, status_forcelist=[500, 502, 503, 504]) - session.mount(base_url, HTTPAdapter(max_retries=retries)) - session.get(base_url) - - -def pytest_configure(config): - if hasattr(config, "workerinput"): - return # don't run configure on xdist worker nodes - base_url = config.getoption("base_url") or config.getini("base_url") - if base_url is not None: - config.option.base_url = base_url - if hasattr(config, "_metadata"): - config._metadata["Base URL"] = base_url - - -def pytest_report_header(config, startdir): - base_url = config.getoption("base_url") - if base_url: - return "baseurl: {0}".format(base_url) - - -def pytest_addoption(parser): - parser.addini("base_url", help="base url for the application under test.") - parser.addoption( - "--base-url", - metavar="url", - default=os.getenv("PYTEST_BASE_URL", None), - help="base url for the application under test.", - ) - parser.addoption( - "--verify-base-url", - action="store_true", - default=not os.getenv("VERIFY_BASE_URL", "false").lower() == "false", - help="verify the base url.", - ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pytest_base_url.egg-info/PKG-INFO new/pytest-base-url-2.0.0/pytest_base_url.egg-info/PKG-INFO --- old/pytest-base-url-1.4.2/pytest_base_url.egg-info/PKG-INFO 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/pytest_base_url.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,186 +0,0 @@ -Metadata-Version: 1.1 -Name: pytest-base-url -Version: 1.4.2 -Summary: pytest plugin for URL based testing -Home-page: https://github.com/pytest-dev/pytest-base-url -Author: Dave Hunt -Author-email: dh...@mozilla.com -License: Mozilla Public License 2.0 (MPL 2.0) -Description: pytest-base-url - =============== - - pytest-base-url is a simple plugin for pytest_ that provides an optional base - URL via the command line or configuration file. - - .. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg - :target: https://github.com/pytest-dev/pytest-base-url/blob/master/LICENSE - :alt: License - .. image:: https://img.shields.io/pypi/v/pytest-base-url.svg - :target: https://pypi.python.org/pypi/pytest-base-url/ - :alt: PyPI - .. image:: https://img.shields.io/travis/pytest-dev/pytest-base-url.svg - :target: https://travis-ci.org/pytest-dev/pytest-base-url/ - :alt: Travis - .. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-base-url.svg - :target: https://github.com/pytest-dev/pytest-base-url/issues - :alt: Issues - .. image:: https://img.shields.io/requires/github/pytest-dev/pytest-base-url.svg - :target: https://requires.io/github/pytest-dev/pytest-base-url/requirements/?branch=master - :alt: Requirements - - Requirements - ------------ - - You will need the following prerequisites in order to use pytest-base-url: - - - Python 2.7, 3.6, PyPy, or PyPy3 - - py.test 2.7 or newer - - Installation - ------------ - - To install pytest-base-url: - - .. code-block:: bash - - $ pip install pytest-base-url - - Contributing - ------------ - - We welcome contributions. - - To learn more, see `Development <https://github.com/pytest-dev/pytest-base-url/blob/master/development.rst>`_ - - Specifying a Base URL - --------------------- - - Rather than repeating or abstracting a base URL in your tests, pytest-base-url - provides a ``base_url`` fixture that returns the specified base URL. - - .. code-block:: python - - import urllib2 - - def test_example(base_url): - assert 200 == urllib2.urlopen(base_url).getcode() - - Using the Command Line - ^^^^^^^^^^^^^^^^^^^^^^ - - You can specify the base URL on the command line: - - .. code-block:: bash - - $ py.test --base-url http://www.example.com - - Using a Configuration File - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - - You can specify the base URL using a `configuration file`_: - - .. code-block:: ini - - [pytest] - base_url = http://www.example.com - - Using an Environment Variable - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - You can specify the base URL by setting the ``PYTEST_BASE_URL`` environment variable. - - Using a Fixture - ^^^^^^^^^^^^^^^ - - If your test harness takes care of launching an instance of your application - under test, you may not have a predictable base URL to provide on the command - line. Fortunately, it's easy to override the ``base_url`` fixture and return - the correct URL to your test. - - In the following example a ``live_server`` fixture is used to start the - application and ``live_server.url`` returns the base URL of the site. - - .. code-block:: python - - import urllib2 - import pytest - - @pytest.fixture - def base_url(live_server): - return live_server.url - - def test_search(base_url): - assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode() - - Available Live Servers - ---------------------- - - It's relatively simple to create your own ``live_server`` fixture, however you - may be able to take advantage of one of the following: - - * Django applications can use pytest-django_'s ``live_server`` fixture. - * Flask applications can use pytest-flask_'s ``live_server`` fixture. - - Verifying the Base URL - ---------------------- - - If you specify a base URL for a site that's unavailable then all tests using - that base URL will likely fail. To avoid running every test in this instance, - you can enable base URL verification. This will check the base URL is - responding before proceeding with the test suite. To enable this, specify the - ``--verify-base-url`` command line option or set the ``VERIFY_BASE_URL`` - environment variable to ``TRUE``. - - Skipping Base URLs - ------------------ - - You can `skip tests`_ based on the value of the base URL so long as it is - provided either by the command line or in a configuration file: - - .. code-block:: python - - import urllib2 - import pytest - - @pytest.mark.skipif( - "'dev' in config.getoption('base_url')", - reason='Search not available on dev') - def test_search(base_url): - assert 200 == urllib2.urlopen('{0}/search'.format(base_url)).getcode() - - Unfortunately if the URL is provided by a fixture, there is no way to know this - value at test collection. - - Resources - --------- - - - `Release Notes`_ - - `Issue Tracker`_ - - Code_ - - .. _pytest: http://www.python.org/ - .. _configuration file: http://pytest.org/latest/customize.html#command-line-options-and-configuration-file-settings - .. _pytest-django: http://pytest-django.readthedocs.org/ - .. _pytest-flask: http://pytest-flask.readthedocs.org/ - .. _skip tests: http://pytest.org/latest/skipping.html - .. _Release Notes: http://github.com/pytest-dev/pytest-base-url/blob/master/CHANGES.rst - .. _Issue Tracker: http://github.com/pytest-dev/pytest-base-url/issues - .. _Code: http://github.com/pytest-dev/pytest-base-url - -Keywords: py.test pytest base url mozilla automation -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Framework :: Pytest -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) -Classifier: Operating System :: POSIX -Classifier: Operating System :: Microsoft :: Windows -Classifier: Operating System :: MacOS :: MacOS X -Classifier: Topic :: Software Development :: Quality Assurance -Classifier: Topic :: Software Development :: Testing -Classifier: Topic :: Utilities -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pytest_base_url.egg-info/SOURCES.txt new/pytest-base-url-2.0.0/pytest_base_url.egg-info/SOURCES.txt --- old/pytest-base-url-1.4.2/pytest_base_url.egg-info/SOURCES.txt 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/pytest_base_url.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.gitignore -.pre-commit-config.yaml -.travis.yml -CHANGES.rst -LICENSE -Pipfile -README.rst -development.rst -setup.cfg -setup.py -tox.ini -pytest_base_url/__init__.py -pytest_base_url/plugin.py -pytest_base_url.egg-info/PKG-INFO -pytest_base_url.egg-info/SOURCES.txt -pytest_base_url.egg-info/dependency_links.txt -pytest_base_url.egg-info/entry_points.txt -pytest_base_url.egg-info/requires.txt -pytest_base_url.egg-info/top_level.txt -tests/__init__.py -tests/conftest.py -tests/test_base_url.py -tests/test_verify_base_url.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pytest_base_url.egg-info/dependency_links.txt new/pytest-base-url-2.0.0/pytest_base_url.egg-info/dependency_links.txt --- old/pytest-base-url-1.4.2/pytest_base_url.egg-info/dependency_links.txt 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/pytest_base_url.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pytest_base_url.egg-info/entry_points.txt new/pytest-base-url-2.0.0/pytest_base_url.egg-info/entry_points.txt --- old/pytest-base-url-1.4.2/pytest_base_url.egg-info/entry_points.txt 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/pytest_base_url.egg-info/entry_points.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -[pytest11] -base_url = pytest_base_url.plugin - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pytest_base_url.egg-info/requires.txt new/pytest-base-url-2.0.0/pytest_base_url.egg-info/requires.txt --- old/pytest-base-url-1.4.2/pytest_base_url.egg-info/requires.txt 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/pytest_base_url.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -pytest>=2.7.3 -requests>=2.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/pytest_base_url.egg-info/top_level.txt new/pytest-base-url-2.0.0/pytest_base_url.egg-info/top_level.txt --- old/pytest-base-url-1.4.2/pytest_base_url.egg-info/top_level.txt 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/pytest_base_url.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -pytest_base_url diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/setup.cfg new/pytest-base-url-2.0.0/setup.cfg --- old/pytest-base-url-1.4.2/setup.cfg 2020-06-20 01:20:38.000000000 +0200 +++ new/pytest-base-url-2.0.0/setup.cfg 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -[bdist_wheel] -universal = 1 - -[egg_info] -tag_build = -tag_date = 0 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/setup.py new/pytest-base-url-2.0.0/setup.py --- old/pytest-base-url-1.4.2/setup.py 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/setup.py 2022-03-27 15:22:04.278417600 +0200 @@ -1,34 +1,38 @@ +# -*- coding: utf-8 -*- from setuptools import setup -setup( - name="pytest-base-url", - use_scm_version=True, - description="pytest plugin for URL based testing", - long_description=open("README.rst").read(), - author="Dave Hunt", - author_email="dh...@mozilla.com", - url="https://github.com/pytest-dev/pytest-base-url", - packages=["pytest_base_url"], - install_requires=["pytest>=2.7.3", "requests>=2.9"], - setup_requires=["setuptools_scm"], - entry_points={"pytest11": ["base_url = pytest_base_url.plugin"]}, - license="Mozilla Public License 2.0 (MPL 2.0)", - keywords="py.test pytest base url mozilla automation", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Framework :: Pytest", - "Intended Audience :: Developers", - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", - "Operating System :: POSIX", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS :: MacOS X", - "Topic :: Software Development :: Quality Assurance", - "Topic :: Software Development :: Testing", - "Topic :: Utilities", - "Programming Language :: Python", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - ], -) +package_dir = \ +{'': 'src'} + +packages = \ +['pytest_base_url'] + +package_data = \ +{'': ['*']} + +install_requires = \ +['pytest>=3.0.0,<8.0.0', 'requests>=2.9'] + +entry_points = \ +{'pytest11': ['base_url = pytest_base_url.plugin']} + +setup_kwargs = { + 'name': 'pytest-base-url', + 'version': '2.0.0', + 'description': 'pytest plugin for URL based testing', + 'long_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 3.7+ or PyPy3\n\nInstallation\n------------\n\nTo install pytest-base-url:\n\n.. code-block:: bash\n\n $ pip install pytest-base-url\n\nContributing\n------------\n\nWe welcome contributions.\n\nTo learn more, see `Development <https://github.com/pytest-dev/pytest-base-url/blob/master/development.rst>`_\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 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://g ithub.com/pytest-dev/pytest-base-url\n', + 'author': 'Dave Hunt', + 'author_email': 'dh...@mozilla.com', + 'maintainer': None, + 'maintainer_email': None, + 'url': 'https://github.com/pytest-dev/pytest-base-url', + 'package_dir': package_dir, + 'packages': packages, + 'package_data': package_data, + 'install_requires': install_requires, + 'entry_points': entry_points, + 'python_requires': '>=3.7,<4.0', +} + + +setup(**setup_kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/src/pytest_base_url/plugin.py new/pytest-base-url-2.0.0/src/pytest_base_url/plugin.py --- old/pytest-base-url-1.4.2/src/pytest_base_url/plugin.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-base-url-2.0.0/src/pytest_base_url/plugin.py 2022-03-27 15:21:27.019980400 +0200 @@ -0,0 +1,65 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import os + +import pytest + + +@pytest.fixture(scope="session") +def base_url(request): + """Return a base URL""" + config = request.config + base_url = config.getoption("base_url") + if base_url is not None: + return base_url + + +@pytest.fixture(scope="session", autouse=True) +def _verify_url(request, base_url): + """Verifies the base URL""" + + verify = request.config.option.verify_base_url + if base_url and verify: + # Lazy load requests to reduce cost for tests that don't use the plugin + import requests + from requests.packages.urllib3.util.retry import Retry + from requests.adapters import HTTPAdapter + + session = requests.Session() + retries = Retry(backoff_factor=0.1, status_forcelist=[500, 502, 503, 504]) + session.mount(base_url, HTTPAdapter(max_retries=retries)) + session.get(base_url) + + +def pytest_configure(config): + if hasattr(config, "workerinput"): + return # don't run configure on xdist worker nodes + base_url = config.getoption("base_url") or config.getini("base_url") + if base_url is not None: + config.option.base_url = base_url + if hasattr(config, "_metadata"): + config._metadata["Base URL"] = base_url + + +def pytest_report_header(config, startdir): + base_url = config.getoption("base_url") + if base_url: + return "baseurl: {0}".format(base_url) + + +def pytest_addoption(parser): + parser.addini("base_url", help="base url for the application under test.") + parser.addoption( + "--base-url", + metavar="url", + default=os.getenv("PYTEST_BASE_URL", None), + help="base url for the application under test.", + ) + parser.addoption( + "--verify-base-url", + action="store_true", + default=not os.getenv("VERIFY_BASE_URL", "false").lower() == "false", + help="verify the base url.", + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/tests/test_verify_base_url.py new/pytest-base-url-2.0.0/tests/test_verify_base_url.py --- old/pytest-base-url-1.4.2/tests/test_verify_base_url.py 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/tests/test_verify_base_url.py 2022-03-27 15:21:27.019980400 +0200 @@ -1,14 +1,15 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -import pytest from requests.packages.urllib3.util.retry import Retry +from packaging.version import Version +from requests.packages.urllib3 import __version__ as URLLIB3_VERSION -# TODO: Remove this when we remove support for python 2.7 -@pytest.fixture(autouse=True) -def httpserver(httpserver): - return httpserver +if Version(URLLIB3_VERSION) < Version("1.26.8"): + BACKOFF_ATTRIB_NAME = "BACKOFF_MAX" +else: + BACKOFF_ATTRIB_NAME = "DEFAULT_BACKOFF_MAX" def test_ignore_bad_url_by_default(testdir, httpserver): @@ -21,7 +22,7 @@ def test_enable_verify_via_cli(testdir, httpserver, monkeypatch): testdir.makepyfile("def test_pass(): pass") monkeypatch.setenv("VERIFY_BASE_URL", "false") - monkeypatch.setattr(Retry, "BACKOFF_MAX", 0.5) + monkeypatch.setattr(Retry, BACKOFF_ATTRIB_NAME, 0.5) status_code = 500 httpserver.serve_content(content="<h1>Error!</h1>", code=status_code) reprec = testdir.inline_run("--base-url", httpserver.url, "--verify-base-url") @@ -36,7 +37,7 @@ def test_enable_verify_via_env(testdir, httpserver, monkeypatch): testdir.makepyfile("def test_pass(): pass") monkeypatch.setenv("VERIFY_BASE_URL", "true") - monkeypatch.setattr(Retry, "BACKOFF_MAX", 0.5) + monkeypatch.setattr(Retry, BACKOFF_ATTRIB_NAME, 0.5) status_code = 500 httpserver.serve_content(content="<h1>Error!</h1>", code=status_code) reprec = testdir.inline_run("--base-url", httpserver.url) @@ -59,7 +60,7 @@ def test_url_fails(testdir, httpserver, monkeypatch): testdir.makepyfile("def test_pass(): pass") monkeypatch.setenv("VERIFY_BASE_URL", "false") - monkeypatch.setattr(Retry, "BACKOFF_MAX", 0.5) + monkeypatch.setattr(Retry, BACKOFF_ATTRIB_NAME, 0.5) reprec = testdir.inline_run("--base-url", "http://foo", "--verify-base-url") passed, skipped, failed = reprec.listoutcomes() out = failed[0].longrepr.reprcrash.message diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-base-url-1.4.2/tox.ini new/pytest-base-url-2.0.0/tox.ini --- old/pytest-base-url-1.4.2/tox.ini 2020-06-20 01:20:18.000000000 +0200 +++ new/pytest-base-url-2.0.0/tox.ini 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -# Tox (http://tox.testrun.org/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - -[tox] -envlist = py{27,36,37,py,py3}, linting - -[testenv] -setenv = PYTHONDONTWRITEBYTECODE=1 -deps = pytest-localserver -commands = pytest -v -r a {posargs} - -[testenv:linting] -skip_install = true -basepython = python3 -deps = pre-commit -commands = pre-commit run --all-files --show-diff-on-failure - -[flake8] -max-line-length = 88 -exclude = .eggs,.tox - -[pytest] -testpaths = tests