Replace hardcoded links to PyPI with extlinks (#9224)

This commit is contained in:
Oleg Höfling 2021-10-22 14:47:57 +02:00 committed by GitHub
parent 2af41c5703
commit 1e9e16d829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1003 additions and 1006 deletions

View File

@ -23,14 +23,13 @@ a full list of details. A few feature highlights:
called if the corresponding setup method succeeded.
- integrate tab-completion on command line options if you
have `argcomplete <https://pypi.org/project/argcomplete/>`_
configured.
have :pypi:`argcomplete` configured.
- allow boolean expression directly with skipif/xfail
if a "reason" is also specified.
- a new hook ``pytest_load_initial_conftests`` allows plugins like
`pytest-django <https://pypi.org/project/pytest-django/>`_ to
:pypi:`pytest-django` to
influence the environment before conftest files import ``django``.
- reporting: color the last line red or green depending if

View File

@ -1004,7 +1004,7 @@ Trivial/Internal Changes
- `#7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed.
- `#7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__.
- `#7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with :pypi:`iniconfig`.
- `#7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``.
@ -1795,7 +1795,7 @@ Removals
For more information consult :std:doc:`deprecations` in the docs.
- `#5565 <https://github.com/pytest-dev/pytest/issues/5565>`_: Removed unused support code for `unittest2 <https://pypi.org/project/unittest2/>`__.
- `#5565 <https://github.com/pytest-dev/pytest/issues/5565>`_: Removed unused support code for :pypi:`unittest2`.
The ``unittest2`` backport module is no longer
necessary since Python 3.3+, and the small amount of code in pytest to support it also doesn't seem
@ -2520,7 +2520,7 @@ Trivial/Internal Changes
- `#4942 <https://github.com/pytest-dev/pytest/issues/4942>`_: ``logging.raiseExceptions`` is not set to ``False`` anymore.
- `#5013 <https://github.com/pytest-dev/pytest/issues/5013>`_: pytest now depends on `wcwidth <https://pypi.org/project/wcwidth>`__ to properly track unicode character sizes for more precise terminal output.
- `#5013 <https://github.com/pytest-dev/pytest/issues/5013>`_: pytest now depends on :pypi:`wcwidth` to properly track unicode character sizes for more precise terminal output.
- `#5059 <https://github.com/pytest-dev/pytest/issues/5059>`_: pytester's ``Testdir.popen()`` uses ``stdout`` and ``stderr`` via keyword arguments with defaults now (``subprocess.PIPE``).
@ -2618,9 +2618,7 @@ Features
- `#4855 <https://github.com/pytest-dev/pytest/issues/4855>`_: The ``--pdbcls`` option handles classes via module attributes now (e.g.
``pdb:pdb.Pdb`` with `pdb++`_), and its validation was improved.
.. _pdb++: https://pypi.org/project/pdbpp/
``pdb:pdb.Pdb`` with :pypi:`pdbpp`), and its validation was improved.
- `#4875 <https://github.com/pytest-dev/pytest/issues/4875>`_: The :confval:`testpaths` configuration option is now displayed next
@ -2691,9 +2689,7 @@ Bug Fixes
Previously they were loaded (imported) always, making e.g. the ``capfd`` fixture available.
- `#4968 <https://github.com/pytest-dev/pytest/issues/4968>`_: The pdb ``quit`` command is handled properly when used after the ``debug`` command with `pdb++`_.
.. _pdb++: https://pypi.org/project/pdbpp/
- `#4968 <https://github.com/pytest-dev/pytest/issues/4968>`_: The pdb ``quit`` command is handled properly when used after the ``debug`` command with :pypi:`pdbpp`.
- `#4975 <https://github.com/pytest-dev/pytest/issues/4975>`_: Fix the interpretation of ``-qq`` option where it was being considered as ``-v`` instead.
@ -3124,7 +3120,7 @@ Features
will not issue the warning.
- `#3632 <https://github.com/pytest-dev/pytest/issues/3632>`_: Richer equality comparison introspection on ``AssertionError`` for objects created using `attrs <https://www.attrs.org/en/stable/>`__ or :mod:`dataclasses` (Python 3.7+, `backported to 3.6 <https://pypi.org/project/dataclasses>`__).
- `#3632 <https://github.com/pytest-dev/pytest/issues/3632>`_: Richer equality comparison introspection on ``AssertionError`` for objects created using `attrs <https://www.attrs.org/en/stable/>`__ or :mod:`dataclasses` (Python 3.7+, :pypi:`backported to 3.6 <dataclasses>`).
- `#4278 <https://github.com/pytest-dev/pytest/issues/4278>`_: ``CACHEDIR.TAG`` files are now created inside cache directories.
@ -4865,8 +4861,7 @@ Features
markers. Also, a ``caplog`` fixture is available that enables users to test
the captured log during specific tests (similar to ``capsys`` for example).
For more information, please see the :doc:`logging docs <how-to/logging>`. This feature was
introduced by merging the popular `pytest-catchlog
<https://pypi.org/project/pytest-catchlog/>`_ plugin, thanks to `Thomas Hisch
introduced by merging the popular :pypi:`pytest-catchlog` plugin, thanks to `Thomas Hisch
<https://github.com/thisch>`_. Be advised that during the merging the
backward compatibility interface with the defunct ``pytest-capturelog`` has
been dropped. (`#2794 <https://github.com/pytest-dev/pytest/issues/2794>`_)
@ -4943,7 +4938,7 @@ Bug Fixes
Trivial/Internal Changes
------------------------
- pytest now depends on `attrs <https://pypi.org/project/attrs/>`__ for internal
- pytest now depends on :pypi:`attrs` for internal
structures to ease code maintainability. (`#2641
<https://github.com/pytest-dev/pytest/issues/2641>`_)

View File

@ -55,6 +55,7 @@ extensions = [
"pygments_pytest",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
@ -145,6 +146,11 @@ linkcheck_ignore = [
linkcheck_workers = 5
extlinks = {
"pypi": ("https://pypi.org/project/%s/", ""),
}
# -- Options for HTML output ---------------------------------------------------
sys.path.append(os.path.abspath("_themes"))
@ -362,6 +368,14 @@ intersphinx_mapping = {
"pluggy": ("https://pluggy.readthedocs.io/en/stable", None),
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable", None),
"pip": ("https://pip.pypa.io/en/stable", None),
"tox": ("https://tox.wiki/en/stable", None),
"virtualenv": ("https://virtualenv.pypa.io/en/stable", None),
"django": (
"http://docs.djangoproject.com/en/stable",
"http://docs.djangoproject.com/en/stable/_objects",
),
"setuptools": ("https://setuptools.pypa.io/en/stable", None),
}

View File

@ -10,7 +10,6 @@ A basic example for specifying tests in Yaml files
--------------------------------------------------------------
.. _`pytest-yamlwsgi`: http://bitbucket.org/aafshar/pytest-yamlwsgi/src/tip/pytest_yamlwsgi.py
.. _`PyYAML`: https://pypi.org/project/PyYAML/
Here is an example ``conftest.py`` (extracted from Ali Afshar's special purpose `pytest-yamlwsgi`_ plugin). This ``conftest.py`` will collect ``test*.yaml`` files and will execute the yaml-formatted content as custom tests:
@ -22,7 +21,7 @@ You can create a simple example file:
.. include:: nonpython/test_simple.yaml
:literal:
and if you installed `PyYAML`_ or a compatible YAML-parser you can
and if you installed :pypi:`PyYAML` or a compatible YAML-parser you can
now execute the test specification:
.. code-block:: pytest

View File

@ -183,9 +183,7 @@ together with the actual data, instead of listing them separately.
A quick port of "testscenarios"
------------------------------------
.. _`test scenarios`: https://pypi.org/project/testscenarios/
Here is a quick port to run tests configured with `test scenarios`_,
Here is a quick port to run tests configured with :pypi:`testscenarios`,
an add-on from Robert Collins for the standard unittest framework. We
only have to work a bit to construct the correct arguments for pytest's
:py:func:`Metafunc.parametrize`:

View File

@ -223,7 +223,7 @@ the command line arguments before they get processed:
num = max(multiprocessing.cpu_count() / 2, 1)
args[:] = ["-n", str(num)] + args
If you have the `xdist plugin <https://pypi.org/project/pytest-xdist/>`_ installed
If you have the :pypi:`xdist plugin <pytest-xdist>` installed
you will now always perform test runs using a number
of subprocesses close to your CPU. Running in an empty
directory with the above conftest.py:
@ -1014,8 +1014,7 @@ which test got stuck, for example if pytest was run in quiet mode (``-q``) or yo
output. This is particularly a problem if the problem happens only sporadically, the famous "flaky" kind of tests.
``pytest`` sets the :envvar:`PYTEST_CURRENT_TEST` environment variable when running tests, which can be inspected
by process monitoring utilities or libraries like `psutil <https://pypi.org/project/psutil/>`_ to discover which
test got stuck if necessary:
by process monitoring utilities or libraries like :pypi:`psutil` to discover which test got stuck if necessary:
.. code-block:: python

View File

@ -154,8 +154,7 @@ This makes use of the automatic caching mechanisms of pytest.
Another good approach is by adding the data files in the ``tests`` folder.
There are also community plugins available to help to manage this aspect of
testing, e.g. `pytest-datadir <https://pypi.org/project/pytest-datadir/>`__
and `pytest-datafiles <https://pypi.org/project/pytest-datafiles/>`__.
testing, e.g. :pypi:`pytest-datadir` and :pypi:`pytest-datafiles`.
.. _fixtures-signal-cleanup:

View File

@ -8,7 +8,7 @@ Install package with pip
-------------------------------------------------
For development, we recommend you use :mod:`venv` for virtual environments and
pip_ for installing your application and any dependencies,
:doc:`pip:index` for installing your application and any dependencies,
as well as the ``pytest`` package itself.
This ensures your code and dependencies are isolated from your system Python installation.
@ -254,17 +254,16 @@ Note that this layout also works in conjunction with the ``src`` layout mentione
much less surprising.
.. _pip: https://pypi.org/project/pip/
.. _`buildout`: http://www.buildout.org/en/latest/
.. _`use tox`:
tox
------
---
Once you are done with your work and want to make sure that your actual
package passes all tests you may want to look into `tox <https://tox.readthedocs.io/>`_, the
virtualenv test automation tool and its `pytest support
<https://tox.readthedocs.io/en/latest/example/pytest.html>`_.
package passes all tests you may want to look into :doc:`tox <tox:index>`, the
virtualenv test automation tool and its :doc:`pytest support <tox:example/pytest>`.
tox helps you to setup virtualenv environments with pre-defined
dependencies and then executing a pre-configured test command with
options. It will run tests against the installed package and not

View File

@ -4,8 +4,8 @@ History
pytest has a long and interesting history. The `first commit
<https://github.com/pytest-dev/pytest/commit/5992a8ef21424d7571305a8d7e2a3431ee7e1e23>`__
in this repository is from January 2007, and even that commit alone already
tells a lot: The repository originally was from the `py
<https://pypi.org/project/py/>`__ library (later split off to pytest), and it
tells a lot: The repository originally was from the :pypi:`py`
library (later split off to pytest), and it
originally was a SVN revision, migrated to Mercurial, and finally migrated to
git.
@ -99,9 +99,8 @@ project:
- It seemed to get rather quiet for a while, and little seemed to happen
between October 2004 (removing ``py`` from PyPy) and January
2007 (first commit in the now-pytest repository). However, there were
various discussions about features/ideas on the mailinglist, and `a
couple of
releases <https://pypi.org/project/py/0.8.0-alpha2/#history>`__ every
various discussions about features/ideas on the mailinglist, and
:pypi:`a couple of releases <py/0.8.0-alpha2/#history>` every
couple of months:
- March 2006: py 0.8.0-alpha2

View File

@ -248,8 +248,8 @@ through ``add_color_level()``. Example:
Release notes
^^^^^^^^^^^^^
This feature was introduced as a drop-in replacement for the `pytest-catchlog
<https://pypi.org/project/pytest-catchlog/>`_ plugin and they conflict
This feature was introduced as a drop-in replacement for the
:pypi:`pytest-catchlog` plugin and they conflict
with each other. The backward compatibility API with ``pytest-capturelog``
has been dropped when this feature was introduced, so if for that reason you
still need ``pytest-catchlog`` you can disable the internal feature by

View File

@ -20,40 +20,38 @@ there is no need to activate it.
Here is a little annotated list for some popular plugins:
.. _`django`: https://www.djangoproject.com/
* :pypi:`pytest-django`: write tests
for :std:doc:`django <django:index>` apps, using pytest integration.
* `pytest-django <https://pypi.org/project/pytest-django/>`_: write tests
for `django`_ apps, using pytest integration.
* `pytest-twisted <https://pypi.org/project/pytest-twisted/>`_: write tests
* :pypi:`pytest-twisted`: write tests
for `twisted <https://twistedmatrix.com/>`_ apps, starting a reactor and
processing deferreds from test functions.
* `pytest-cov <https://pypi.org/project/pytest-cov/>`__:
* :pypi:`pytest-cov`:
coverage reporting, compatible with distributed testing
* `pytest-xdist <https://pypi.org/project/pytest-xdist/>`_:
* :pypi:`pytest-xdist`:
to distribute tests to CPUs and remote hosts, to run in boxed
mode which allows to survive segmentation faults, to run in
looponfailing mode, automatically re-running failing tests
on file changes.
* `pytest-instafail <https://pypi.org/project/pytest-instafail/>`_:
* :pypi:`pytest-instafail`:
to report failures while the test run is happening.
* `pytest-bdd <https://pypi.org/project/pytest-bdd/>`_:
* :pypi:`pytest-bdd`:
to write tests using behaviour-driven testing.
* `pytest-timeout <https://pypi.org/project/pytest-timeout/>`_:
* :pypi:`pytest-timeout`:
to timeout tests based on function marks or global definitions.
* `pytest-pep8 <https://pypi.org/project/pytest-pep8/>`_:
* :pypi:`pytest-pep8`:
a ``--pep8`` option to enable PEP8 compliance checking.
* `pytest-flakes <https://pypi.org/project/pytest-flakes/>`_:
* :pypi:`pytest-flakes`:
check source code with pyflakes.
* `oejskit <https://pypi.org/project/oejskit/>`_:
* :pypi:`oejskit`:
a plugin to run javascript unittests in live browsers.
To see a complete list of all plugins with their latest testing

View File

@ -46,9 +46,9 @@ in most cases without having to modify existing code:
* :ref:`maxfail`;
* :ref:`--pdb <pdb-option>` command-line option for debugging on test failures
(see :ref:`note <pdb-unittest-note>` below);
* Distribute tests to multiple CPUs using the `pytest-xdist <https://pypi.org/project/pytest-xdist/>`_ plugin;
* Use :ref:`plain assert-statements <assert>` instead of ``self.assert*`` functions (`unittest2pytest
<https://pypi.org/project/unittest2pytest/>`__ is immensely helpful in this);
* Distribute tests to multiple CPUs using the :pypi:`pytest-xdist` plugin;
* Use :ref:`plain assert-statements <assert>` instead of ``self.assert*`` functions
(:pypi:`unittest2pytest` is immensely helpful in this);
pytest features in ``unittest.TestCase`` subclasses

View File

@ -120,7 +120,7 @@ The option receives a ``name`` parameter, which can be:
* A full module dotted name, for example ``myproject.plugins``. This dotted name must be importable.
* The entry-point name of a plugin. This is the name passed to ``setuptools`` when the plugin is
registered. For example to early-load the `pytest-cov <https://pypi.org/project/pytest-cov/>`__ plugin you can use::
registered. For example to early-load the :pypi:`pytest-cov` plugin you can use::
pytest -p pytest_cov

View File

@ -115,8 +115,6 @@ Here is how you might run it::
Writing your own plugin
-----------------------
.. _`setuptools`: https://pypi.org/project/setuptools/
If you want to write a plugin, there are many real-life examples
you can copy from:
@ -150,7 +148,7 @@ Making your plugin installable by others
If you want to make your plugin externally available, you
may define a so-called entry point for your distribution so
that ``pytest`` finds your plugin module. Entry points are
a feature that is provided by `setuptools`_. pytest looks up
a feature that is provided by :std:doc:`setuptools:index`. pytest looks up
the ``pytest11`` entrypoint to discover its
plugins and you can thus make your plugin available by defining
it in your setuptools-invocation:

View File

@ -19,7 +19,7 @@ scale to support complex functional testing for applications and libraries.
**Pythons**: ``pytest`` requires: Python 3.6, 3.7, 3.8, 3.9, or PyPy3.
**PyPI package name**: `pytest <https://pypi.org/project/pytest/>`_
**PyPI package name**: :pypi:`pytest`
**Documentation as PDF**: `download latest <https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf>`_

View File

@ -120,7 +120,7 @@ all parameters marked as a fixture.
.. note::
The `pytest-lazy-fixture <https://pypi.org/project/pytest-lazy-fixture/>`_ plugin implements a very
The :pypi:`pytest-lazy-fixture` plugin implements a very
similar solution to the proposal below, make sure to check it out.
.. code-block:: python

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ def iter_plugins():
)
last_release = release_date.strftime("%b %d, %Y")
break
name = f'`{info["name"]} <{info["project_url"]}>`_'
name = f':pypi:`{info["name"]}`'
summary = escape_rst(info["summary"].replace("\n", ""))
yield {
"name": name,