Skip to content

Add Missing Docstrings to validate_basetemp in main.py #13373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/13091.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added Sphinx-compatible docstrings and inline comments for basetemp function in `pytest/src/_pytest/main.py`
12 changes: 12 additions & 0 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@ def pytest_addoption(parser: Parser) -> None:


def validate_basetemp(path: str) -> str:
"""
Validate the provided `basetemp` path to ensure it is not empty,
the current working directory (cwd), or any ancestor of the cwd.
Returns the validated basetemp path.
Raises argparse.ArgumentTypeError in 3 cases:
1) if the path is empty;
2) if it is the cwd;
3) if it is an ancestor of the cwd.


param: path (str): The basetemp path.
"""
# GH 7119
msg = "basetemp must not be empty, the current working directory or any parent directory of it"

Expand Down