Skip to content

Commit 1e9e16d

Browse files
authored
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

Lines changed: 2 additions & 3 deletions
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

Lines changed: 8 additions & 13 deletions
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 2 additions & 3 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 5 additions & 6 deletions
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

Lines changed: 4 additions & 5 deletions
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

Lines changed: 2 additions & 2 deletions
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

0 commit comments

Comments
 (0)