Skip to content

Commit 78ed3e4

Browse files
authored
Merge pull request #7729 from bluetech/doc-fix-crossrefs
doc: fix a few broken cross references
2 parents 9c0e0c7 + e503c9a commit 78ed3e4

9 files changed

+27
-31
lines changed

doc/en/cache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ the cache and nothing will be printed:
264264
FAILED test_caching.py::test_function - assert 42 == 23
265265
1 failed in 0.12s
266266
267-
See the :fixture:`config.cache fixture <config.cache>` for more details.
267+
See the :fixture:`config.cache fixture <cache>` for more details.
268268

269269

270270
Inspecting Cache content

doc/en/deprecations.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Deprecated Features
1616
-------------------
1717

1818
Below is a complete list of all pytest features which are considered deprecated. Using those features will issue
19-
:class:`_pytest.warning_types.PytestWarning` or subclasses, which can be filtered using
20-
:ref:`standard warning filters <warnings>`.
19+
:class:`PytestWarning` or subclasses, which can be filtered using :ref:`standard warning filters <warnings>`.
2120

2221

2322
The ``pytest_warning_captured`` hook
@@ -376,7 +375,7 @@ Metafunc.addcall
376375

377376
.. versionremoved:: 4.0
378377

379-
:meth:`_pytest.python.Metafunc.addcall` was a precursor to the current parametrized mechanism. Users should use
378+
``_pytest.python.Metafunc.addcall`` was a precursor to the current parametrized mechanism. Users should use
380379
:meth:`_pytest.python.Metafunc.parametrize` instead.
381380

382381
Example:
@@ -611,7 +610,7 @@ This has been documented as deprecated for years, but only now we are actually e
611610

612611
.. versionremoved:: 4.0
613612

614-
As part of a large :ref:`marker-revamp`, :meth:`_pytest.nodes.Node.get_marker` is deprecated. See
613+
As part of a large :ref:`marker-revamp`, ``_pytest.nodes.Node.get_marker`` is removed. See
615614
:ref:`the documentation <update marker code>` on tips on how to update your code.
616615

617616

doc/en/fixture.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ will not be executed.
592592
Fixtures can introspect the requesting test context
593593
-------------------------------------------------------------
594594

595-
Fixture functions can accept the :py:class:`request <FixtureRequest>` object
595+
Fixture functions can accept the :py:class:`request <_pytest.fixtures.FixtureRequest>` object
596596
to introspect the "requesting" test function, class or module context.
597597
Further extending the previous ``smtp_connection`` fixture example, let's
598598
read an optional server URL from the test module which uses our fixture:
@@ -664,7 +664,7 @@ from the module namespace.
664664
Using markers to pass data to fixtures
665665
-------------------------------------------------------------
666666

667-
Using the :py:class:`request <FixtureRequest>` object, a fixture can also access
667+
Using the :py:class:`request <_pytest.fixtures.FixtureRequest>` object, a fixture can also access
668668
markers which are applied to a test function. This can be useful to pass data
669669
into a fixture from a test:
670670

doc/en/funcarg_compare.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ There are several limitations and difficulties with this approach:
5151
performs parametrization at the places where the resource
5252
is used. Moreover, you need to modify the factory to use an
5353
``extrakey`` parameter containing ``request.param`` to the
54-
:py:func:`~python.Request.cached_setup` call.
54+
``Request.cached_setup`` call.
5555

5656
3. Multiple parametrized session-scoped resources will be active
5757
at the same time, making it hard for them to affect global state
@@ -113,7 +113,7 @@ This new way of parametrizing funcarg factories should in many cases
113113
allow to re-use already written factories because effectively
114114
``request.param`` was already used when test functions/classes were
115115
parametrized via
116-
:py:func:`~_pytest.python.Metafunc.parametrize(indirect=True)` calls.
116+
:py:func:`metafunc.parametrize(indirect=True) <_pytest.python.Metafunc.parametrize>` calls.
117117

118118
Of course it's perfectly fine to combine parametrization and scoping:
119119

doc/en/historical-notes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ More details can be found in the `original PR <https://github.com/pytest-dev/pyt
112112
.. note::
113113

114114
in a future major release of pytest we will introduce class based markers,
115-
at which point markers will no longer be limited to instances of :py:class:`Mark`.
115+
at which point markers will no longer be limited to instances of :py:class:`~_pytest.mark.Mark`.
116116

117117

118118
cache plugin integrated into the core

doc/en/monkeypatch.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,25 @@ Consider the following scenarios:
3333

3434
1. Modifying the behavior of a function or the property of a class for a test e.g.
3535
there is an API call or database connection you will not make for a test but you know
36-
what the expected output should be. Use :py:meth:`monkeypatch.setattr` to patch the
36+
what the expected output should be. Use :py:meth:`monkeypatch.setattr <MonkeyPatch.setattr>` to patch the
3737
function or property with your desired testing behavior. This can include your own functions.
38-
Use :py:meth:`monkeypatch.delattr` to remove the function or property for the test.
38+
Use :py:meth:`monkeypatch.delattr <MonkeyPatch.delattr>` to remove the function or property for the test.
3939

4040
2. Modifying the values of dictionaries e.g. you have a global configuration that
41-
you want to modify for certain test cases. Use :py:meth:`monkeypatch.setitem` to patch the
42-
dictionary for the test. :py:meth:`monkeypatch.delitem` can be used to remove items.
41+
you want to modify for certain test cases. Use :py:meth:`monkeypatch.setitem <MonkeyPatch.setitem>` to patch the
42+
dictionary for the test. :py:meth:`monkeypatch.delitem <MonkeyPatch.delitem>` can be used to remove items.
4343

4444
3. Modifying environment variables for a test e.g. to test program behavior if an
4545
environment variable is missing, or to set multiple values to a known variable.
46-
:py:meth:`monkeypatch.setenv` and :py:meth:`monkeypatch.delenv` can be used for
46+
:py:meth:`monkeypatch.setenv <MonkeyPatch.setenv>` and :py:meth:`monkeypatch.delenv <MonkeyPatch.delenv>` can be used for
4747
these patches.
4848

4949
4. Use ``monkeypatch.setenv("PATH", value, prepend=os.pathsep)`` to modify ``$PATH``, and
50-
:py:meth:`monkeypatch.chdir` to change the context of the current working directory
50+
:py:meth:`monkeypatch.chdir <MonkeyPatch.chdir>` to change the context of the current working directory
5151
during a test.
5252

53-
5. Use :py:meth:`monkeypatch.syspath_prepend` to modify ``sys.path`` which will also
54-
call :py:meth:`pkg_resources.fixup_namespace_packages` and :py:meth:`importlib.invalidate_caches`.
53+
5. Use :py:meth:`monkeypatch.syspath_prepend <MonkeyPatch.syspath_prepend>` to modify ``sys.path`` which will also
54+
call ``pkg_resources.fixup_namespace_packages`` and :py:func:`importlib.invalidate_caches`.
5555

5656
See the `monkeypatch blog post`_ for some introduction material
5757
and a discussion of its motivation.
@@ -66,10 +66,10 @@ testing, you do not want your test to depend on the running user. ``monkeypatch`
6666
can be used to patch functions dependent on the user to always return a
6767
specific value.
6868

69-
In this example, :py:meth:`monkeypatch.setattr` is used to patch ``Path.home``
69+
In this example, :py:meth:`monkeypatch.setattr <MonkeyPatch.setattr>` is used to patch ``Path.home``
7070
so that the known testing path ``Path("/abc")`` is always used when the test is run.
7171
This removes any dependency on the running user for testing purposes.
72-
:py:meth:`monkeypatch.setattr` must be called before the function which will use
72+
:py:meth:`monkeypatch.setattr <MonkeyPatch.setattr>` must be called before the function which will use
7373
the patched function is called.
7474
After the test function finishes the ``Path.home`` modification will be undone.
7575

@@ -102,7 +102,7 @@ After the test function finishes the ``Path.home`` modification will be undone.
102102
Monkeypatching returned objects: building mock classes
103103
------------------------------------------------------
104104

105-
:py:meth:`monkeypatch.setattr` can be used in conjunction with classes to mock returned
105+
:py:meth:`monkeypatch.setattr <MonkeyPatch.setattr>` can be used in conjunction with classes to mock returned
106106
objects from functions instead of values.
107107
Imagine a simple function to take an API url and return the json response.
108108

@@ -330,7 +330,7 @@ This behavior can be moved into ``fixture`` structures and shared across tests:
330330
Monkeypatching dictionaries
331331
---------------------------
332332

333-
:py:meth:`monkeypatch.setitem` can be used to safely set the values of dictionaries
333+
:py:meth:`monkeypatch.setitem <MonkeyPatch.setitem>` can be used to safely set the values of dictionaries
334334
to specific values during tests. Take this simplified connection string example:
335335

336336
.. code-block:: python
@@ -367,7 +367,7 @@ For testing purposes we can patch the ``DEFAULT_CONFIG`` dictionary to specific
367367
result = app.create_connection_string()
368368
assert result == expected
369369
370-
You can use the :py:meth:`monkeypatch.delitem` to remove values.
370+
You can use the :py:meth:`monkeypatch.delitem <MonkeyPatch.delitem>` to remove values.
371371

372372
.. code-block:: python
373373

doc/en/reference.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,14 +539,11 @@ recwarn
539539
.. autofunction:: recwarn()
540540
:no-auto-options:
541541

542-
.. autoclass:: _pytest.recwarn.WarningsRecorder()
542+
.. autoclass:: WarningsRecorder()
543543
:members:
544544

545545
Each recorded warning is an instance of :class:`warnings.WarningMessage`.
546546

547-
.. note::
548-
:class:`RecordedWarning` was changed from a plain class to a namedtuple in pytest 3.1
549-
550547
.. note::
551548
``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated
552549
differently; see :ref:`ensuring_function_triggers`.
@@ -688,8 +685,8 @@ All runtest related hooks receive a :py:class:`pytest.Item <pytest.Item>` object
688685
.. autofunction:: pytest_runtest_makereport
689686

690687
For deeper understanding you may look at the default implementation of
691-
these hooks in :py:mod:`_pytest.runner` and maybe also
692-
in :py:mod:`_pytest.pdb` which interacts with :py:mod:`_pytest.capture`
688+
these hooks in ``_pytest.runner`` and maybe also
689+
in ``_pytest.pdb`` which interacts with ``_pytest.capture``
693690
and its input/output capturing in order to immediately drop
694691
into interactive debugging when a test failure occurs.
695692

doc/en/warnings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ warnings, or index into it to get a particular recorded warning.
367367

368368
.. currentmodule:: _pytest.warnings
369369

370-
Full API: :class:`WarningsRecorder`.
370+
Full API: :class:`~_pytest.recwarn.WarningsRecorder`.
371371

372372
.. _custom_failure_messages:
373373

src/_pytest/tmpdir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class TempdirFactory:
111111
_tmppath_factory = attr.ib(type=TempPathFactory)
112112

113113
def mktemp(self, basename: str, numbered: bool = True) -> py.path.local:
114-
"""Same as :meth:`TempPathFactory.mkdir`, but returns a ``py.path.local`` object."""
114+
"""Same as :meth:`TempPathFactory.mktemp`, but returns a ``py.path.local`` object."""
115115
return py.path.local(self._tmppath_factory.mktemp(basename, numbered).resolve())
116116

117117
def getbasetemp(self) -> py.path.local:

0 commit comments

Comments
 (0)