Skip to content

Commit 1e9e16d

Browse files
authoredOct 22, 2021
Replace hardcoded links to PyPI with extlinks (#9224)
1 parent 2af41c5 commit 1e9e16d

18 files changed

+1003
-1006
lines changed
 

‎doc/en/announce/release-2.4.0.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ a full list of details. A few feature highlights:
2323
called if the corresponding setup method succeeded.
2424

2525
- integrate tab-completion on command line options if you
26-
have `argcomplete <https://pypi.org/project/argcomplete/>`_
27-
configured.
26+
have :pypi:`argcomplete` configured.
2827

2928
- allow boolean expression directly with skipif/xfail
3029
if a "reason" is also specified.
3130

3231
- a new hook ``pytest_load_initial_conftests`` allows plugins like
33-
`pytest-django <https://pypi.org/project/pytest-django/>`_ to
32+
:pypi:`pytest-django` to
3433
influence the environment before conftest files import ``django``.
3534

3635
- reporting: color the last line red or green depending if

‎doc/en/changelog.rst

+8-13
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ Trivial/Internal Changes
10041004
- `#7264 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed.
10051005

10061006

1007-
- `#7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__.
1007+
- `#7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with :pypi:`iniconfig`.
10081008

10091009

10101010
- `#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
17951795
For more information consult :std:doc:`deprecations` in the docs.
17961796

17971797

1798-
- `#5565 <https://github.com/pytest-dev/pytest/issues/5565>`_: Removed unused support code for `unittest2 <https://pypi.org/project/unittest2/>`__.
1798+
- `#5565 <https://github.com/pytest-dev/pytest/issues/5565>`_: Removed unused support code for :pypi:`unittest2`.
17991799

18001800
The ``unittest2`` backport module is no longer
18011801
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
25202520
- `#4942 <https://github.com/pytest-dev/pytest/issues/4942>`_: ``logging.raiseExceptions`` is not set to ``False`` anymore.
25212521

25222522

2523-
- `#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.
2523+
- `#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.
25242524

25252525

25262526
- `#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
26182618

26192619

26202620
- `#4855 <https://github.com/pytest-dev/pytest/issues/4855>`_: The ``--pdbcls`` option handles classes via module attributes now (e.g.
2621-
``pdb:pdb.Pdb`` with `pdb++`_), and its validation was improved.
2622-
2623-
.. _pdb++: https://pypi.org/project/pdbpp/
2621+
``pdb:pdb.Pdb`` with :pypi:`pdbpp`), and its validation was improved.
26242622

26252623

26262624
- `#4875 <https://github.com/pytest-dev/pytest/issues/4875>`_: The :confval:`testpaths` configuration option is now displayed next
@@ -2691,9 +2689,7 @@ Bug Fixes
26912689
Previously they were loaded (imported) always, making e.g. the ``capfd`` fixture available.
26922690

26932691

2694-
- `#4968 <https://github.com/pytest-dev/pytest/issues/4968>`_: The pdb ``quit`` command is handled properly when used after the ``debug`` command with `pdb++`_.
2695-
2696-
.. _pdb++: https://pypi.org/project/pdbpp/
2692+
- `#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`.
26972693

26982694

26992695
- `#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
31243120
will not issue the warning.
31253121

31263122

3127-
- `#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>`__).
3123+
- `#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>`).
31283124

31293125

31303126
- `#4278 <https://github.com/pytest-dev/pytest/issues/4278>`_: ``CACHEDIR.TAG`` files are now created inside cache directories.
@@ -4865,8 +4861,7 @@ Features
48654861
markers. Also, a ``caplog`` fixture is available that enables users to test
48664862
the captured log during specific tests (similar to ``capsys`` for example).
48674863
For more information, please see the :doc:`logging docs <how-to/logging>`. This feature was
4868-
introduced by merging the popular `pytest-catchlog
4869-
<https://pypi.org/project/pytest-catchlog/>`_ plugin, thanks to `Thomas Hisch
4864+
introduced by merging the popular :pypi:`pytest-catchlog` plugin, thanks to `Thomas Hisch
48704865
<https://github.com/thisch>`_. Be advised that during the merging the
48714866
backward compatibility interface with the defunct ``pytest-capturelog`` has
48724867
been dropped. (`#2794 <https://github.com/pytest-dev/pytest/issues/2794>`_)
@@ -4943,7 +4938,7 @@ Bug Fixes
49434938
Trivial/Internal Changes
49444939
------------------------
49454940

4946-
- pytest now depends on `attrs <https://pypi.org/project/attrs/>`__ for internal
4941+
- pytest now depends on :pypi:`attrs` for internal
49474942
structures to ease code maintainability. (`#2641
49484943
<https://github.com/pytest-dev/pytest/issues/2641>`_)
49494944

‎doc/en/conf.py

+14
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"pygments_pytest",
5656
"sphinx.ext.autodoc",
5757
"sphinx.ext.autosummary",
58+
"sphinx.ext.extlinks",
5859
"sphinx.ext.intersphinx",
5960
"sphinx.ext.todo",
6061
"sphinx.ext.viewcode",
@@ -145,6 +146,11 @@
145146
linkcheck_workers = 5
146147

147148

149+
extlinks = {
150+
"pypi": ("https://pypi.org/project/%s/", ""),
151+
}
152+
153+
148154
# -- Options for HTML output ---------------------------------------------------
149155

150156
sys.path.append(os.path.abspath("_themes"))
@@ -362,6 +368,14 @@
362368
"pluggy": ("https://pluggy.readthedocs.io/en/stable", None),
363369
"python": ("https://docs.python.org/3", None),
364370
"numpy": ("https://numpy.org/doc/stable", None),
371+
"pip": ("https://pip.pypa.io/en/stable", None),
372+
"tox": ("https://tox.wiki/en/stable", None),
373+
"virtualenv": ("https://virtualenv.pypa.io/en/stable", None),
374+
"django": (
375+
"http://docs.djangoproject.com/en/stable",
376+
"http://docs.djangoproject.com/en/stable/_objects",
377+
),
378+
"setuptools": ("https://setuptools.pypa.io/en/stable", None),
365379
}
366380

367381

‎doc/en/example/nonpython.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ A basic example for specifying tests in Yaml files
1010
--------------------------------------------------------------
1111

1212
.. _`pytest-yamlwsgi`: http://bitbucket.org/aafshar/pytest-yamlwsgi/src/tip/pytest_yamlwsgi.py
13-
.. _`PyYAML`: https://pypi.org/project/PyYAML/
1413

1514
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:
1615

@@ -22,7 +21,7 @@ You can create a simple example file:
2221
.. include:: nonpython/test_simple.yaml
2322
:literal:
2423

25-
and if you installed `PyYAML`_ or a compatible YAML-parser you can
24+
and if you installed :pypi:`PyYAML` or a compatible YAML-parser you can
2625
now execute the test specification:
2726

2827
.. code-block:: pytest

‎doc/en/example/parametrize.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ together with the actual data, instead of listing them separately.
183183
A quick port of "testscenarios"
184184
------------------------------------
185185

186-
.. _`test scenarios`: https://pypi.org/project/testscenarios/
187-
188-
Here is a quick port to run tests configured with `test scenarios`_,
186+
Here is a quick port to run tests configured with :pypi:`testscenarios`,
189187
an add-on from Robert Collins for the standard unittest framework. We
190188
only have to work a bit to construct the correct arguments for pytest's
191189
:py:func:`Metafunc.parametrize`:

‎doc/en/example/simple.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ the command line arguments before they get processed:
223223
num = max(multiprocessing.cpu_count() / 2, 1)
224224
args[:] = ["-n", str(num)] + args
225225
226-
If you have the `xdist plugin <https://pypi.org/project/pytest-xdist/>`_ installed
226+
If you have the :pypi:`xdist plugin <pytest-xdist>` installed
227227
you will now always perform test runs using a number
228228
of subprocesses close to your CPU. Running in an empty
229229
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
10141014
output. This is particularly a problem if the problem happens only sporadically, the famous "flaky" kind of tests.
10151015

10161016
``pytest`` sets the :envvar:`PYTEST_CURRENT_TEST` environment variable when running tests, which can be inspected
1017-
by process monitoring utilities or libraries like `psutil <https://pypi.org/project/psutil/>`_ to discover which
1018-
test got stuck if necessary:
1017+
by process monitoring utilities or libraries like :pypi:`psutil` to discover which test got stuck if necessary:
10191018

10201019
.. code-block:: python
10211020

‎doc/en/explanation/fixtures.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ This makes use of the automatic caching mechanisms of pytest.
154154

155155
Another good approach is by adding the data files in the ``tests`` folder.
156156
There are also community plugins available to help to manage this aspect of
157-
testing, e.g. `pytest-datadir <https://pypi.org/project/pytest-datadir/>`__
158-
and `pytest-datafiles <https://pypi.org/project/pytest-datafiles/>`__.
157+
testing, e.g. :pypi:`pytest-datadir` and :pypi:`pytest-datafiles`.
159158

160159
.. _fixtures-signal-cleanup:
161160

‎doc/en/explanation/goodpractices.rst

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Install package with pip
88
-------------------------------------------------
99

1010
For development, we recommend you use :mod:`venv` for virtual environments and
11-
pip_ for installing your application and any dependencies,
11+
:doc:`pip:index` for installing your application and any dependencies,
1212
as well as the ``pytest`` package itself.
1313
This ensures your code and dependencies are isolated from your system Python installation.
1414

@@ -254,17 +254,16 @@ Note that this layout also works in conjunction with the ``src`` layout mentione
254254
much less surprising.
255255

256256

257-
.. _pip: https://pypi.org/project/pip/
257+
.. _`buildout`: http://www.buildout.org/en/latest/
258258

259259
.. _`use tox`:
260260

261261
tox
262-
------
262+
---
263263

264264
Once you are done with your work and want to make sure that your actual
265-
package passes all tests you may want to look into `tox <https://tox.readthedocs.io/>`_, the
266-
virtualenv test automation tool and its `pytest support
267-
<https://tox.readthedocs.io/en/latest/example/pytest.html>`_.
265+
package passes all tests you may want to look into :doc:`tox <tox:index>`, the
266+
virtualenv test automation tool and its :doc:`pytest support <tox:example/pytest>`.
268267
tox helps you to setup virtualenv environments with pre-defined
269268
dependencies and then executing a pre-configured test command with
270269
options. It will run tests against the installed package and not

‎doc/en/history.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ History
44
pytest has a long and interesting history. The `first commit
55
<https://github.com/pytest-dev/pytest/commit/5992a8ef21424d7571305a8d7e2a3431ee7e1e23>`__
66
in this repository is from January 2007, and even that commit alone already
7-
tells a lot: The repository originally was from the `py
8-
<https://pypi.org/project/py/>`__ library (later split off to pytest), and it
7+
tells a lot: The repository originally was from the :pypi:`py`
8+
library (later split off to pytest), and it
99
originally was a SVN revision, migrated to Mercurial, and finally migrated to
1010
git.
1111

@@ -99,9 +99,8 @@ project:
9999
- It seemed to get rather quiet for a while, and little seemed to happen
100100
between October 2004 (removing ``py`` from PyPy) and January
101101
2007 (first commit in the now-pytest repository). However, there were
102-
various discussions about features/ideas on the mailinglist, and `a
103-
couple of
104-
releases <https://pypi.org/project/py/0.8.0-alpha2/#history>`__ every
102+
various discussions about features/ideas on the mailinglist, and
103+
:pypi:`a couple of releases <py/0.8.0-alpha2/#history>` every
105104
couple of months:
106105

107106
- March 2006: py 0.8.0-alpha2

‎doc/en/how-to/logging.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ through ``add_color_level()``. Example:
248248
Release notes
249249
^^^^^^^^^^^^^
250250

251-
This feature was introduced as a drop-in replacement for the `pytest-catchlog
252-
<https://pypi.org/project/pytest-catchlog/>`_ plugin and they conflict
251+
This feature was introduced as a drop-in replacement for the
252+
:pypi:`pytest-catchlog` plugin and they conflict
253253
with each other. The backward compatibility API with ``pytest-capturelog``
254254
has been dropped when this feature was introduced, so if for that reason you
255255
still need ``pytest-catchlog`` you can disable the internal feature by

‎doc/en/how-to/plugins.rst

+11-13
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,38 @@ there is no need to activate it.
2020

2121
Here is a little annotated list for some popular plugins:
2222

23-
.. _`django`: https://www.djangoproject.com/
23+
* :pypi:`pytest-django`: write tests
24+
for :std:doc:`django <django:index>` apps, using pytest integration.
2425

25-
* `pytest-django <https://pypi.org/project/pytest-django/>`_: write tests
26-
for `django`_ apps, using pytest integration.
27-
28-
* `pytest-twisted <https://pypi.org/project/pytest-twisted/>`_: write tests
26+
* :pypi:`pytest-twisted`: write tests
2927
for `twisted <https://twistedmatrix.com/>`_ apps, starting a reactor and
3028
processing deferreds from test functions.
3129

32-
* `pytest-cov <https://pypi.org/project/pytest-cov/>`__:
30+
* :pypi:`pytest-cov`:
3331
coverage reporting, compatible with distributed testing
3432

35-
* `pytest-xdist <https://pypi.org/project/pytest-xdist/>`_:
33+
* :pypi:`pytest-xdist`:
3634
to distribute tests to CPUs and remote hosts, to run in boxed
3735
mode which allows to survive segmentation faults, to run in
3836
looponfailing mode, automatically re-running failing tests
3937
on file changes.
4038

41-
* `pytest-instafail <https://pypi.org/project/pytest-instafail/>`_:
39+
* :pypi:`pytest-instafail`:
4240
to report failures while the test run is happening.
4341

44-
* `pytest-bdd <https://pypi.org/project/pytest-bdd/>`_:
42+
* :pypi:`pytest-bdd`:
4543
to write tests using behaviour-driven testing.
4644

47-
* `pytest-timeout <https://pypi.org/project/pytest-timeout/>`_:
45+
* :pypi:`pytest-timeout`:
4846
to timeout tests based on function marks or global definitions.
4947

50-
* `pytest-pep8 <https://pypi.org/project/pytest-pep8/>`_:
48+
* :pypi:`pytest-pep8`:
5149
a ``--pep8`` option to enable PEP8 compliance checking.
5250

53-
* `pytest-flakes <https://pypi.org/project/pytest-flakes/>`_:
51+
* :pypi:`pytest-flakes`:
5452
check source code with pyflakes.
5553

56-
* `oejskit <https://pypi.org/project/oejskit/>`_:
54+
* :pypi:`oejskit`:
5755
a plugin to run javascript unittests in live browsers.
5856

5957
To see a complete list of all plugins with their latest testing

‎doc/en/how-to/unittest.rst

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

5353

5454
pytest features in ``unittest.TestCase`` subclasses

‎doc/en/how-to/usage.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ The option receives a ``name`` parameter, which can be:
120120

121121
* A full module dotted name, for example ``myproject.plugins``. This dotted name must be importable.
122122
* The entry-point name of a plugin. This is the name passed to ``setuptools`` when the plugin is
123-
registered. For example to early-load the `pytest-cov <https://pypi.org/project/pytest-cov/>`__ plugin you can use::
123+
registered. For example to early-load the :pypi:`pytest-cov` plugin you can use::
124124

125125
pytest -p pytest_cov
126126

‎doc/en/how-to/writing_plugins.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ Here is how you might run it::
115115
Writing your own plugin
116116
-----------------------
117117

118-
.. _`setuptools`: https://pypi.org/project/setuptools/
119-
120118
If you want to write a plugin, there are many real-life examples
121119
you can copy from:
122120

@@ -150,7 +148,7 @@ Making your plugin installable by others
150148
If you want to make your plugin externally available, you
151149
may define a so-called entry point for your distribution so
152150
that ``pytest`` finds your plugin module. Entry points are
153-
a feature that is provided by `setuptools`_. pytest looks up
151+
a feature that is provided by :std:doc:`setuptools:index`. pytest looks up
154152
the ``pytest11`` entrypoint to discover its
155153
plugins and you can thus make your plugin available by defining
156154
it in your setuptools-invocation:

‎doc/en/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ scale to support complex functional testing for applications and libraries.
1919

2020
**Pythons**: ``pytest`` requires: Python 3.6, 3.7, 3.8, 3.9, or PyPy3.
2121

22-
**PyPI package name**: `pytest <https://pypi.org/project/pytest/>`_
22+
**PyPI package name**: :pypi:`pytest`
2323

2424
**Documentation as PDF**: `download latest <https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf>`_
2525

‎doc/en/proposals/parametrize_with_fixtures.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ all parameters marked as a fixture.
120120

121121
.. note::
122122

123-
The `pytest-lazy-fixture <https://pypi.org/project/pytest-lazy-fixture/>`_ plugin implements a very
123+
The :pypi:`pytest-lazy-fixture` plugin implements a very
124124
similar solution to the proposal below, make sure to check it out.
125125

126126
.. code-block:: python

‎doc/en/reference/plugin_list.rst

+944-944
Large diffs are not rendered by default.

‎scripts/update-plugin-list.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def iter_plugins():
7575
)
7676
last_release = release_date.strftime("%b %d, %Y")
7777
break
78-
name = f'`{info["name"]} <{info["project_url"]}>`_'
78+
name = f':pypi:`{info["name"]}`'
7979
summary = escape_rst(info["summary"].replace("\n", ""))
8080
yield {
8181
"name": name,

0 commit comments

Comments
 (0)
Please sign in to comment.