[7.4.x] reference: improve the node types docs a bit (#11181)

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
github-actions[bot]
2023-07-08 19:07:55 +00:00
committed by GitHub
parent 511adf85be
commit a566b78730
4 changed files with 105 additions and 80 deletions

View File

@@ -522,7 +522,7 @@ class PyCollector(PyobjMixin, nodes.Collector):
class Module(nodes.File, PyCollector):
"""Collector for test classes and functions."""
"""Collector for test classes and functions in a Python module."""
def _getobj(self):
return self._importtestmodule()
@@ -659,6 +659,9 @@ class Module(nodes.File, PyCollector):
class Package(Module):
"""Collector for files and directories in a Python packages -- directories
with an `__init__.py` file."""
def __init__(
self,
fspath: Optional[LEGACY_PATH],
@@ -788,7 +791,7 @@ def _get_first_non_fixture_func(obj: object, names: Iterable[str]) -> Optional[o
class Class(PyCollector):
"""Collector for test methods."""
"""Collector for test methods (and nested classes) in a Python class."""
@classmethod
def from_parent(cls, parent, *, name, obj=None, **kw):
@@ -1673,7 +1676,7 @@ def write_docstring(tw: TerminalWriter, doc: str, indent: str = " ") -> None:
class Function(PyobjMixin, nodes.Item):
"""An Item responsible for setting up and executing a Python test function.
"""Item responsible for setting up and executing a Python test function.
:param name:
The full function name, including any decorations like those
@@ -1830,10 +1833,8 @@ class Function(PyobjMixin, nodes.Item):
class FunctionDefinition(Function):
"""
This class is a step gap solution until we evolve to have actual function definition nodes
and manage to get rid of ``metafunc``.
"""
"""This class is a stop gap solution until we evolve to have actual function
definition nodes and manage to get rid of ``metafunc``."""
def runtest(self) -> None:
raise RuntimeError("function definitions are not supposed to be run as tests")