diff --git a/_pytest/python_api.py b/_pytest/python_api.py index 541371449..e5a73a353 100644 --- a/_pytest/python_api.py +++ b/_pytest/python_api.py @@ -547,8 +547,9 @@ def raises(expected_exception, *args, **kwargs): The string will be evaluated using the same ``locals()`` and ``globals()`` at the moment of the ``raises`` call. - .. autoclass:: _pytest._code.ExceptionInfo - :members: + .. currentmodule:: _pytest._code + + Consult the API of ``excinfo`` objects: :class:`ExceptionInfo`. .. note:: Similar to caught exception objects in Python, explicitly clearing diff --git a/doc/en/monkeypatch.rst b/doc/en/monkeypatch.rst index 0c07b2f44..a2327d4fa 100644 --- a/doc/en/monkeypatch.rst +++ b/doc/en/monkeypatch.rst @@ -63,13 +63,9 @@ so that any attempts within tests to create http requests will fail. help although there's no guarantee. -Method reference of the monkeypatch fixture -------------------------------------------- +.. currentmodule:: _pytest.monkeypatch -.. autoclass:: MonkeyPatch - :members: - -``monkeypatch.setattr/delattr/delitem/delenv()`` all -by default raise an Exception if the target does not exist. -Pass ``raising=False`` if you want to skip this check. +API Reference +------------- +Consult the docs for the :class:`MonkeyPatch` class. diff --git a/doc/en/reference.rst b/doc/en/reference.rst index fa39f1ac7..e8cf441fa 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -196,6 +196,9 @@ Full reference to objects accessible from :ref:`fixtures ` or hooks :members: :show-inheritance: +.. autoclass:: _pytest._code.ExceptionInfo + :members: + .. autoclass:: _pytest.nodes.FSCollector() :members: :show-inheritance: @@ -427,10 +430,27 @@ record_xml_property caplog ~~~~~~ +**Tutorial**: :doc:`logging`. + .. autofunction:: _pytest.logging.caplog() :no-auto-options: - This returns a :class:`_pytest.logging.LogCaptureFixture`. + This returns a :class:`_pytest.logging.LogCaptureFixture` instance. .. autoclass:: _pytest.logging.LogCaptureFixture :members: + + +monkeypatch +~~~~~~~~~~~ + +**Tutorial**: :doc:`monkeypatch`. + +.. autofunction:: _pytest.monkeypatch.monkeypatch() + :no-auto-options: + + This returns a :class:`_pytest.monkeypatch.MonkeyPatch` instance. + +.. autoclass:: _pytest.monkeypatch.MonkeyPatch + :members: +