Skip to content

Add spec_container_format#65

Closed
joshuaprior wants to merge 2 commits into
pchomik:masterfrom
joshuaprior:add-container-formatting
Closed

Add spec_container_format#65
joshuaprior wants to merge 2 commits into
pchomik:masterfrom
joshuaprior:add-container-formatting

Conversation

@joshuaprior

Copy link
Copy Markdown
Contributor

What's changing

This change adds support for a new formatting string called spec_container_format. This format string provides three variables:

  • sentence - displays the describe/class name as a sentence with first letter capitalized and underscores removed
  • unit_name - mostly leaves the describe/class name untouched except to remove describe_ or Test from the front
  • docstring_summary - displays the first line of the docstring if one exists, uses sentence formatting as fallback if a docstring is not available

Required integration

I submitted a PR to pytest-describe to expose a new API that allows the describe functions to be obtained by reporting plugins. Without this enhancement the docstring_summary formatting option will always fallback to sentence formatting.

Example

image

{sentence} - Formats the function name into a sentence.

{unit_name} - Just strips off the describe_ assuming that the rest of the function name is the name of the unit under test.

{docstring_summary} - Use the first line of the describe docstring. If no docstring is defined then defaults to {sentence}.
@pchomik pchomik self-assigned this Apr 5, 2026
@pchomik

pchomik commented Apr 5, 2026

Copy link
Copy Markdown
Owner

Thanks for PR. I will review it soon.

@joshuaprior

Copy link
Copy Markdown
Contributor Author

Actually, I gave it some thought over the weekend. I want to propose a different change. I'll try to get it to you by the end of day today.

@joshuaprior joshuaprior closed this Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants