Fix documentation for Config/InvocationParams
This commit is contained in:
parent
a42e85ed54
commit
dc5219a9c0
|
@ -735,26 +735,19 @@ class Config:
|
||||||
"""
|
"""
|
||||||
Access to configuration values, pluginmanager and plugin hooks.
|
Access to configuration values, pluginmanager and plugin hooks.
|
||||||
|
|
||||||
:ivar PytestPluginManager pluginmanager: the plugin manager handles plugin registration and hook invocation.
|
:param PytestPluginManager pluginmanager:
|
||||||
|
|
||||||
:ivar argparse.Namespace option: access to command line option as attributes.
|
|
||||||
|
|
||||||
:ivar InvocationParams invocation_params:
|
|
||||||
|
|
||||||
|
:param InvocationParams invocation_params:
|
||||||
Object containing the parameters regarding the ``pytest.main``
|
Object containing the parameters regarding the ``pytest.main``
|
||||||
invocation.
|
invocation.
|
||||||
|
|
||||||
Contains the following read-only attributes:
|
|
||||||
|
|
||||||
* ``args``: tuple of command-line arguments as passed to ``pytest.main()``.
|
|
||||||
* ``plugins``: list of extra plugins, might be None.
|
|
||||||
* ``dir``: directory where ``pytest.main()`` was invoked from.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@attr.s(frozen=True)
|
@attr.s(frozen=True)
|
||||||
class InvocationParams:
|
class InvocationParams:
|
||||||
"""Holds parameters passed during ``pytest.main()``
|
"""Holds parameters passed during ``pytest.main()``
|
||||||
|
|
||||||
|
The object attributes are read-only.
|
||||||
|
|
||||||
.. versionadded:: 5.1
|
.. versionadded:: 5.1
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
@ -766,10 +759,18 @@ class Config:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
args = attr.ib(converter=tuple)
|
args = attr.ib(converter=tuple)
|
||||||
|
"""tuple of command-line arguments as passed to ``pytest.main()``."""
|
||||||
plugins = attr.ib()
|
plugins = attr.ib()
|
||||||
|
"""list of extra plugins, might be `None`."""
|
||||||
dir = attr.ib(type=Path)
|
dir = attr.ib(type=Path)
|
||||||
|
"""directory where ``pytest.main()`` was invoked from."""
|
||||||
|
|
||||||
def __init__(self, pluginmanager, *, invocation_params=None) -> None:
|
def __init__(
|
||||||
|
self,
|
||||||
|
pluginmanager: PytestPluginManager,
|
||||||
|
*,
|
||||||
|
invocation_params: InvocationParams = None
|
||||||
|
) -> None:
|
||||||
from .argparsing import Parser, FILE_OR_DIR
|
from .argparsing import Parser, FILE_OR_DIR
|
||||||
|
|
||||||
if invocation_params is None:
|
if invocation_params is None:
|
||||||
|
@ -778,6 +779,10 @@ class Config:
|
||||||
)
|
)
|
||||||
|
|
||||||
self.option = argparse.Namespace()
|
self.option = argparse.Namespace()
|
||||||
|
"""access to command line option as attributes.
|
||||||
|
|
||||||
|
:type: argparse.Namespace"""
|
||||||
|
|
||||||
self.invocation_params = invocation_params
|
self.invocation_params = invocation_params
|
||||||
|
|
||||||
_a = FILE_OR_DIR
|
_a = FILE_OR_DIR
|
||||||
|
@ -786,6 +791,10 @@ class Config:
|
||||||
processopt=self._processopt,
|
processopt=self._processopt,
|
||||||
)
|
)
|
||||||
self.pluginmanager = pluginmanager
|
self.pluginmanager = pluginmanager
|
||||||
|
"""the plugin manager handles plugin registration and hook invocation.
|
||||||
|
|
||||||
|
:type: PytestPluginManager"""
|
||||||
|
|
||||||
self.trace = self.pluginmanager.trace.root.get("config")
|
self.trace = self.pluginmanager.trace.root.get("config")
|
||||||
self.hook = self.pluginmanager.hook
|
self.hook = self.pluginmanager.hook
|
||||||
self._inicache = {} # type: Dict[str, Any]
|
self._inicache = {} # type: Dict[str, Any]
|
||||||
|
|
Loading…
Reference in New Issue