Skip to content

Commit

Permalink
add the extra sphinx annotations to refer to Path instances
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Jun 17, 2024
1 parent 57bfa02 commit a71f079
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions doc/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
from textwrap import dedent
from typing import TYPE_CHECKING

from _pytest import __version__ as version
from _pytest import __version__ as full_version


version = full_version.split("+")[0]

if TYPE_CHECKING:
import sphinx.application

Expand Down Expand Up @@ -169,7 +171,6 @@
nitpick_ignore = [
# TODO (fix in pluggy?)
("py:class", "HookCaller"),
("py:class", "Path"), # figure how to map to interpshinx
("py:class", "HookspecMarker"),
("py:exc", "PluginValidationError"),
# Might want to expose/TODO (https://github.com/pytest-dev/pytest/issues/7469)
Expand Down
6 changes: 6 additions & 0 deletions src/_pytest/hookspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def pytest_ignore_collect(
Stops at first non-None result, see :ref:`firstresult`.
:param collection_path: The path to analyze.
:type collection_path: pathlib.Path
:param path: The path to analyze (deprecated).
:param config: The pytest config object.
Expand Down Expand Up @@ -354,6 +355,7 @@ def pytest_collect_directory(path: Path, parent: Collector) -> Collector | None:
Stops at first non-None result, see :ref:`firstresult`.
:param path: The path to analyze.
:type path: pathlib.Path
See :ref:`custom directory collectors` for a simple example of use of this
hook.
Expand Down Expand Up @@ -386,6 +388,7 @@ def pytest_collect_file(
The new node needs to have the specified ``parent`` as a parent.
:param file_path: The path to analyze.
:type file_path: pathlib.Path
:param path: The path to collect (deprecated).
.. versionchanged:: 7.0.0
Expand Down Expand Up @@ -507,6 +510,7 @@ def pytest_pycollect_makemodule(
Stops at first non-None result, see :ref:`firstresult`.
:param module_path: The path of the module to collect.
:type module_path: pathlib.Path
:param path: The path of the module to collect (deprecated).
.. versionchanged:: 7.0.0
Expand Down Expand Up @@ -1026,6 +1030,7 @@ def pytest_report_header( # type:ignore[empty-body]
:param config: The pytest config object.
:param start_path: The starting dir.
:type start_path: pathlib.Path
:param startdir: The starting dir (deprecated).
.. note::
Expand Down Expand Up @@ -1069,6 +1074,7 @@ def pytest_report_collectionfinish( # type:ignore[empty-body]
:param config: The pytest config object.
:param start_path: The starting dir.
:type start_path: pathlib.Path
:param startdir: The starting dir (deprecated).
:param items: List of pytest items that are going to be executed; this list should not be modified.
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def from_parent( # type: ignore[override]
:param parent: The parent collector of this Dir.
:param path: The directory's path.
:type path: :ref:`python:pathlib.Path`
:type path: pathlib.Path
"""
return super().from_parent(parent=parent, path=path)

Expand Down
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ commands =
# the '-t changelog_towncrier_draft' tags makes sphinx include the draft
# changelog in the docs; this does not happen on ReadTheDocs because it uses
# the standard sphinx command so the 'changelog_towncrier_draft' is never set there
sphinx-build -W --keep-going -b html doc/en doc/en/_build/html -t changelog_towncrier_draft {posargs:}
sphinx-build \
-j auto \
-W --keep-going \
-b html doc/en doc/en/_build/html \
-t changelog_towncrier_draft {posargs:}
setenv =
# Sphinx is not clean of this warning.
PYTHONWARNDEFAULTENCODING=
Expand Down

0 comments on commit a71f079

Please sign in to comment.