Skip to content

Commit 54f7a87

Browse files
authored
Merge pull request #7714 from bluetech/doc-prefer-public
doc: prefer to reference by public name when possible
2 parents db12d79 + 0ca2327 commit 54f7a87

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

doc/en/fixture.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Fixtures as Function arguments
121121
Test functions can receive fixture objects by naming them as an input
122122
argument. For each argument name, a fixture function with that name provides
123123
the fixture object. Fixture functions are registered by marking them with
124-
:py:func:`@pytest.fixture <_pytest.python.fixture>`. Let's look at a simple
124+
:py:func:`@pytest.fixture <pytest.fixture>`. Let's look at a simple
125125
self-contained test module containing a fixture and a test function
126126
using it:
127127

@@ -144,7 +144,7 @@ using it:
144144
assert 0 # for demo purposes
145145
146146
Here, the ``test_ehlo`` needs the ``smtp_connection`` fixture value. pytest
147-
will discover and call the :py:func:`@pytest.fixture <_pytest.python.fixture>`
147+
will discover and call the :py:func:`@pytest.fixture <pytest.fixture>`
148148
marked ``smtp_connection`` fixture function. Running the test looks like this:
149149

150150
.. code-block:: pytest
@@ -252,7 +252,7 @@ Scope: sharing fixtures across classes, modules, packages or session
252252
Fixtures requiring network access depend on connectivity and are
253253
usually time-expensive to create. Extending the previous example, we
254254
can add a ``scope="module"`` parameter to the
255-
:py:func:`@pytest.fixture <_pytest.python.fixture>` invocation
255+
:py:func:`@pytest.fixture <pytest.fixture>` invocation
256256
to cause the decorated ``smtp_connection`` fixture function to only be invoked
257257
once per test *module* (the default is to invoke once per test *function*).
258258
Multiple test functions in a test module will thus
@@ -775,7 +775,7 @@ through the special :py:class:`request <FixtureRequest>` object:
775775
smtp_connection.close()
776776
777777
The main change is the declaration of ``params`` with
778-
:py:func:`@pytest.fixture <_pytest.python.fixture>`, a list of values
778+
:py:func:`@pytest.fixture <pytest.fixture>`, a list of values
779779
for each of which the fixture function will execute and can access
780780
a value via ``request.param``. No test function code needs to change.
781781
So let's just do another run:

doc/en/reference.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ For example:
240240
...
241241
242242
Will create and attach a :class:`Mark <_pytest.mark.structures.Mark>` object to the collected
243-
:class:`Item <_pytest.nodes.Item>`, which can then be accessed by fixtures or hooks with
243+
:class:`Item <pytest.Item>`, which can then be accessed by fixtures or hooks with
244244
:meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>`. The ``mark`` object will have the following attributes:
245245

246246
.. code-block:: python
@@ -676,7 +676,7 @@ items, delete or otherwise amend the test items:
676676
Test running (runtest) hooks
677677
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
678678

679-
All runtest related hooks receive a :py:class:`pytest.Item <_pytest.main.Item>` object.
679+
All runtest related hooks receive a :py:class:`pytest.Item <pytest.Item>` object.
680680

681681
.. autofunction:: pytest_runtestloop
682682
.. autofunction:: pytest_runtest_protocol
@@ -752,14 +752,14 @@ CallInfo
752752
Class
753753
~~~~~
754754

755-
.. autoclass:: _pytest.python.Class()
755+
.. autoclass:: pytest.Class()
756756
:members:
757757
:show-inheritance:
758758

759759
Collector
760760
~~~~~~~~~
761761

762-
.. autoclass:: _pytest.nodes.Collector()
762+
.. autoclass:: pytest.Collector()
763763
:members:
764764
:show-inheritance:
765765

@@ -787,13 +787,13 @@ ExceptionInfo
787787
ExitCode
788788
~~~~~~~~
789789

790-
.. autoclass:: _pytest.config.ExitCode
790+
.. autoclass:: pytest.ExitCode
791791
:members:
792792

793793
File
794794
~~~~
795795

796-
.. autoclass:: _pytest.nodes.File()
796+
.. autoclass:: pytest.File()
797797
:members:
798798
:show-inheritance:
799799

@@ -815,14 +815,14 @@ FSCollector
815815
Function
816816
~~~~~~~~
817817

818-
.. autoclass:: _pytest.python.Function()
818+
.. autoclass:: pytest.Function()
819819
:members:
820820
:show-inheritance:
821821

822822
Item
823823
~~~~
824824

825-
.. autoclass:: _pytest.nodes.Item()
825+
.. autoclass:: pytest.Item()
826826
:members:
827827
:show-inheritance:
828828

@@ -856,7 +856,7 @@ Metafunc
856856
Module
857857
~~~~~~
858858

859-
.. autoclass:: _pytest.python.Module()
859+
.. autoclass:: pytest.Module()
860860
:members:
861861
:show-inheritance:
862862

@@ -885,7 +885,7 @@ PytestPluginManager
885885
Session
886886
~~~~~~~
887887

888-
.. autoclass:: _pytest.main.Session()
888+
.. autoclass:: pytest.Session()
889889
:members:
890890
:show-inheritance:
891891

@@ -1027,7 +1027,7 @@ When set (regardless of value), pytest will use color in terminal output.
10271027
Exceptions
10281028
----------
10291029

1030-
.. autoclass:: _pytest.config.UsageError()
1030+
.. autoclass:: pytest.UsageError()
10311031
:show-inheritance:
10321032

10331033
.. _`warnings ref`:

doc/en/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Running ``pytest`` can result in six different exit codes:
3333
:Exit code 4: pytest command line usage error
3434
:Exit code 5: No tests were collected
3535

36-
They are represented by the :class:`_pytest.config.ExitCode` enum. The exit codes being a part of the public API can be imported and accessed directly using:
36+
They are represented by the :class:`pytest.ExitCode` enum. The exit codes being a part of the public API can be imported and accessed directly using:
3737

3838
.. code-block:: python
3939

src/_pytest/hookspec.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def pytest_collection(session: "Session") -> Optional[object]:
237237
for example the terminal plugin uses it to start displaying the collection
238238
counter (and returns `None`).
239239
240-
:param _pytest.main.Session session: The pytest session object.
240+
:param pytest.Session session: The pytest session object.
241241
"""
242242

243243

@@ -247,16 +247,16 @@ def pytest_collection_modifyitems(
247247
"""Called after collection has been performed. May filter or re-order
248248
the items in-place.
249249
250-
:param _pytest.main.Session session: The pytest session object.
250+
:param pytest.Session session: The pytest session object.
251251
:param _pytest.config.Config config: The pytest config object.
252-
:param List[_pytest.nodes.Item] items: List of item objects.
252+
:param List[pytest.Item] items: List of item objects.
253253
"""
254254

255255

256256
def pytest_collection_finish(session: "Session") -> None:
257257
"""Called after collection has been performed and modified.
258258
259-
:param _pytest.main.Session session: The pytest session object.
259+
:param pytest.Session session: The pytest session object.
260260
"""
261261

262262

@@ -393,7 +393,7 @@ def pytest_runtestloop(session: "Session") -> Optional[object]:
393393
If at any point ``session.shouldfail`` or ``session.shouldstop`` are set, the
394394
loop is terminated after the runtest protocol for the current item is finished.
395395
396-
:param _pytest.main.Session session: The pytest session object.
396+
:param pytest.Session session: The pytest session object.
397397
398398
Stops at first non-None result, see :ref:`firstresult`.
399399
The return value is not used, but only stops further processing.
@@ -572,7 +572,7 @@ def pytest_sessionstart(session: "Session") -> None:
572572
"""Called after the ``Session`` object has been created and before performing collection
573573
and entering the run test loop.
574574
575-
:param _pytest.main.Session session: The pytest session object.
575+
:param pytest.Session session: The pytest session object.
576576
"""
577577

578578

@@ -581,7 +581,7 @@ def pytest_sessionfinish(
581581
) -> None:
582582
"""Called after whole test run finished, right before returning the exit status to the system.
583583
584-
:param _pytest.main.Session session: The pytest session object.
584+
:param pytest.Session session: The pytest session object.
585585
:param int exitstatus: The status which pytest will return to the system.
586586
"""
587587

@@ -633,7 +633,7 @@ def pytest_assertion_pass(item: "Item", lineno: int, orig: str, expl: str) -> No
633633
You need to **clean the .pyc** files in your project directory and interpreter libraries
634634
when enabling this option, as assertions will require to be re-written.
635635
636-
:param _pytest.nodes.Item item: pytest item object of current test.
636+
:param pytest.Item item: pytest item object of current test.
637637
:param int lineno: Line number of the assert statement.
638638
:param str orig: String with the original assertion.
639639
:param str expl: String with the assert explanation.

0 commit comments

Comments
 (0)