Skip to content

Python(fix): clean docstrings captured in pytest#658

Merged
alexluck-sift merged 1 commit into
mainfrom
al/python/fix/pytest-step-docstring-storage
Jun 26, 2026
Merged

Python(fix): clean docstrings captured in pytest#658
alexluck-sift merged 1 commit into
mainfrom
al/python/fix/pytest-step-docstring-storage

Conversation

@alexluck-sift

@alexluck-sift alexluck-sift commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

The pytest plugin stored test step descriptions straight from __doc__. For leaf steps (test functions) the raw docstring was used as-is, so an indented multi-line docstring kept its source indentation on every line after the first, plus surrounding blank lines. For hierarchy parents (package/module/class) only .strip() was applied, which trims the ends but leaves interior indentation in place.

Both extraction points now use inspect.getdoc, which dedents interior lines, trims surrounding blank lines, and falls back to an inherited docstring when the object itself has none. The existing try/except guards and the empty-to-None behavior are preserved.

The leaf-step test is updated to assert the stored description against the dedented literal and to confirm it differs from the raw __doc__, so a regression back to raw storage fails the test.

@github-actions

Copy link
Copy Markdown
Contributor

Python docs preview: https://sift-stack.github.io/sift/python/pr-658/

Deployed from cca7eab. The link may take up to a minute to become live as GitHub Pages propagates.

@alexluck-sift alexluck-sift merged commit 4fe5de1 into main Jun 26, 2026
26 checks passed
@alexluck-sift alexluck-sift deleted the al/python/fix/pytest-step-docstring-storage branch June 26, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants