-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Show "short test summary info" after tracebacks and warnings #3255
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -480,16 +480,21 @@ def pytest_sessionfinish(self, exitstatus): | |
EXIT_NOTESTSCOLLECTED) | ||
if exitstatus in summary_exit_codes: | ||
self.config.hook.pytest_terminal_summary(terminalreporter=self, | ||
config=self.config, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dito |
||
exitstatus=exitstatus) | ||
self.summary_errors() | ||
self.summary_failures() | ||
self.summary_warnings() | ||
self.summary_passes() | ||
if exitstatus == EXIT_INTERRUPTED: | ||
self._report_keyboardinterrupt() | ||
del self._keyboardinterrupt_memo | ||
self.summary_stats() | ||
|
||
@pytest.hookimpl(hookwrapper=True) | ||
def pytest_terminal_summary(self): | ||
self.summary_errors() | ||
self.summary_failures() | ||
yield | ||
self.summary_warnings() | ||
self.summary_passes() | ||
|
||
def pytest_keyboard_interrupt(self, excinfo): | ||
self._keyboardinterrupt_memo = excinfo.getrepr(funcargs=True) | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The *short test summary info* section now is displayed after tracebacks and warnings in the terminal. |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a breaking change, any caller of the hook would need to add the extra parameter
this needs to be addressed in pluggy first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hook is called only by
terminal.py
, and we've added parameters to hooks in the past, it's not clear to me why this hook in particular cannot receive an extra argument at this point.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this particular hooks its probably less of an issue, however all hooks and the required arguments they take are currently part of the public api
for example
pytest_deselected
is in dire need of a addedreason
argument however its one of the hooks that are supposed to be called by 3rd parties, and they would simply breakThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean regarding
pytest_deselected
, but AFAIK this is the only hook where we expect to be called by 3rd parties, all other hooks are called by pytest itself.So IMHO your concern is valid but not for most hooks.
Having said all that, if you really want I can remove the parameter, it was not really required by the hook implementations I touched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im leaning torwards removing it, but as you said, its unlikely to be invoked by 3rd parties as of now
we ought to create a mechanism trough which 3rd parties defer to hooks later on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, removed it. 👍