Skip to content

Commit 0354e90

Browse files
ali90hnicoddemus
andauthored
docs(cacheprovider): add missing docstrings (#13665)
Closes #13625 --------- Co-authored-by: Bruno Oliveira <[email protected]>
1 parent d1e931a commit 0354e90

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

changelog/13625.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added missing docstrings to ``pytest_addoption()``, ``pytest_configure()``, and ``cacheshow()`` functions in ``cacheprovider.py``.

src/_pytest/cacheprovider.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ def pytest_sessionfinish(self) -> None:
476476

477477

478478
def pytest_addoption(parser: Parser) -> None:
479+
"""Add command-line options for cache functionality.
480+
481+
:param parser: Parser object to add command-line options to.
482+
"""
479483
group = parser.getgroup("general")
480484
group.addoption(
481485
"--lf",
@@ -546,6 +550,13 @@ def pytest_cmdline_main(config: Config) -> int | ExitCode | None:
546550

547551
@hookimpl(tryfirst=True)
548552
def pytest_configure(config: Config) -> None:
553+
"""Configure cache system and register related plugins.
554+
555+
Creates the Cache instance and registers the last-failed (LFPlugin)
556+
and new-first (NFPlugin) plugins with the plugin manager.
557+
558+
:param config: pytest configuration object.
559+
"""
549560
config.cache = Cache.for_config(config, _ispytest=True)
550561
config.pluginmanager.register(LFPlugin(config), "lfplugin")
551562
config.pluginmanager.register(NFPlugin(config), "nfplugin")
@@ -584,6 +595,16 @@ def pytest_report_header(config: Config) -> str | None:
584595

585596

586597
def cacheshow(config: Config, session: Session) -> int:
598+
"""Display cache contents when --cache-show is used.
599+
600+
Shows cached values and directories matching the specified glob pattern
601+
(default: '*'). Displays cache location, cached test results, and
602+
any cached directories created by plugins.
603+
604+
:param config: pytest configuration object.
605+
:param session: pytest session object.
606+
:returns: Exit code (0 for success).
607+
"""
587608
from pprint import pformat
588609

589610
assert config.cache is not None

0 commit comments

Comments
 (0)