Add spec_container_format#65
Closed
joshuaprior wants to merge 2 commits into
Closed
Conversation
{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}.
Owner
|
Thanks for PR. I will review it soon. |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 removedunit_name- mostly leaves the describe/class name untouched except to removedescribe_orTestfrom the frontdocstring_summary- displays the first line of the docstring if one exists, usessentenceformatting as fallback if a docstring is not availableRequired 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_summaryformatting option will always fallback tosentenceformatting.Example