Add reference docs to doctest_namespace
This commit is contained in:
parent
749288dcb6
commit
70f93263e9
|
@ -379,6 +379,6 @@ def _fix_spoof_python2(runner, encoding):
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def doctest_namespace():
|
def doctest_namespace():
|
||||||
"""
|
"""
|
||||||
Inject names into the doctest namespace.
|
Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
|
||||||
"""
|
"""
|
||||||
return dict()
|
return dict()
|
||||||
|
|
|
@ -116,6 +116,8 @@ itself::
|
||||||
'Hello'
|
'Hello'
|
||||||
|
|
||||||
|
|
||||||
|
.. _`doctest_namespace`:
|
||||||
|
|
||||||
The 'doctest_namespace' fixture
|
The 'doctest_namespace' fixture
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
|
|
@ -260,8 +260,6 @@ capsys
|
||||||
.. currentmodule:: _pytest.capture
|
.. currentmodule:: _pytest.capture
|
||||||
|
|
||||||
.. autofunction:: capsys()
|
.. autofunction:: capsys()
|
||||||
:no-auto-options:
|
|
||||||
:decorator:
|
|
||||||
|
|
||||||
Returns an instance of :py:class:`CaptureFixture`.
|
Returns an instance of :py:class:`CaptureFixture`.
|
||||||
|
|
||||||
|
@ -279,8 +277,6 @@ capsysbinary
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
.. autofunction:: capsysbinary()
|
.. autofunction:: capsysbinary()
|
||||||
:no-auto-options:
|
|
||||||
:decorator:
|
|
||||||
|
|
||||||
Returns an instance of :py:class:`CaptureFixture`.
|
Returns an instance of :py:class:`CaptureFixture`.
|
||||||
|
|
||||||
|
@ -298,8 +294,6 @@ capfd
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
.. autofunction:: capfd()
|
.. autofunction:: capfd()
|
||||||
:no-auto-options:
|
|
||||||
:decorator:
|
|
||||||
|
|
||||||
Returns an instance of :py:class:`CaptureFixture`.
|
Returns an instance of :py:class:`CaptureFixture`.
|
||||||
|
|
||||||
|
@ -317,8 +311,6 @@ capfdbinary
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
.. autofunction:: capfdbinary()
|
.. autofunction:: capfdbinary()
|
||||||
:no-auto-options:
|
|
||||||
:decorator:
|
|
||||||
|
|
||||||
Returns an instance of :py:class:`CaptureFixture`.
|
Returns an instance of :py:class:`CaptureFixture`.
|
||||||
|
|
||||||
|
@ -332,3 +324,17 @@ capfdbinary
|
||||||
assert captured.out == b"hello\n"
|
assert captured.out == b"hello\n"
|
||||||
|
|
||||||
|
|
||||||
|
doctest_namespace
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. autofunction:: _pytest.doctest.doctest_namespace()
|
||||||
|
|
||||||
|
Usually this fixture is used in conjunction with another ``autouse`` fixture:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def add_np(doctest_namespace):
|
||||||
|
doctest_namespace['np'] = numpy
|
||||||
|
|
||||||
|
For more details: :ref:`doctest_namespace`.
|
||||||
|
|
Loading…
Reference in New Issue