Skip to content

feat: better annotation structure - #14

Merged
utgwkk merged 3 commits into
pytest-dev:masterfrom
henryiii:henryiii/short
Aug 21, 2020
Merged

utgwkk merged 3 commits into
pytest-dev:masterfrom
henryiii:henryiii/short

Conversation

@henryiii

@henryiii henryiii commented Aug 20, 2020 •

Copy link
Copy Markdown
Contributor

Closes #13

The annotation structure is redesigned to be more concise and clear, and to work with parametrized tests. The old structure repeated the code already visible in GHA, included the whole containing function, regardless of how long it was, and didn't tell you which invocation the error was from for parametrized tests.

The changes:

  • The actual line number of the error is used
  • The first line is the test is the run name, including any parametrization, class names, etc.
  • Only the error explanation (can be multiline) is shown (without all the extra E's)

Here's an example of something before and after:

Before

Screen Shot 2020-08-20 at 10 47 59 AM

After

Screen Shot 2020-08-20 at 10 48 34 AM

Example run: before, after

Based on https://github.com/pytest-dev/pytest/blob/master/src/_pytest/terminal.py
Maybe this could be 0.1.0? :)

@henryiii
henryiii marked this pull request as draft August 20, 2020 14:17
@henryiii
henryiii marked this pull request as ready for review August 20, 2020 14:27

@utgwkk utgwkk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good to me, please fix tests.

Comment thread plugin_test.py Resolved
Comment thread plugin_test.py Resolved
Comment thread plugin_test.py Resolved
@utgwkk

utgwkk commented Aug 21, 2020

Copy link
Copy Markdown
Member

Maybe this could be 0.1.0? :)

Yes, I want to release this feature with a new minor version!

@utgwkk
utgwkk merged commit e209a1e into pytest-dev:master Aug 21, 2020
@utgwkk utgwkk mentioned this pull request Aug 21, 2020
@henryiii
henryiii deleted the henryiii/short branch August 23, 2020 12:49
@amezin

amezin commented Jan 22, 2022

Copy link
Copy Markdown

Why is this PR switching from pytest_runtest_logreport to pytest_runtest_makereport? Not sure about rerunfailures #30 , but for another similar plugin - flaky - this change creates unnecessary annotations. pytest_runtest_logreport is called only once for a test: https://github.com/box/flaky/blob/master/flaky/flaky_pytest_plugin.py#L145-L149 but pytest_runtest_makereport is called for every rerun.

@henryiii henryiii mentioned this pull request Jul 27, 2023
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.

Mention --tb=short?

3 participants