Skip to content
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

Display "short test summary info" after (main) warnings again #4399

Merged
merged 1 commit into from
Nov 23, 2018

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Nov 15, 2018

Fixes #3952.

Ref: #3956.

self.summary_warnings()
yield
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"short test summary info" comes via the skipping plugin, which I found rather confusing.
Should/can this be moved?

It would also might make sense to have "short test summary info" after "summary_passes" even, but I wanted to not touch that behavior (and am not using it - -ra does not include P).

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm if we move it to pytest_terminal_summary, will it simplify things? It doesn't look so simple to move it, because there's some logic in there to handle summaries for xpass, xfail, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is quite messy.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should add a comment here explaining why we display warnings twice, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

@@ -726,11 +727,19 @@ def summary_warnings(self):
if not all_warnings:
return

final = hasattr(self, "_already_displayed_warnings")
Copy link
Member

Choose a reason for hiding this comment

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

Hmm I'm not sure, I understand the rationale for the change, but I'm not so happy with how this turns out... 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried to use args for this first, but considered that there are only 2 steps and an attribute/marker can do it.

I've tried to keep the patch minimal.

@blueyed
Copy link
Contributor Author

blueyed commented Nov 22, 2018

@nicoddemus
Thanks for reviewing this anyway already! :)

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

This solves a real problem and I don't see a clearer way to implement this, so I'm 👍 for the change, thanks!

Would like a second eyes on it before we merge it though.

self.summary_warnings()
yield
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should add a comment here explaining why we display warnings twice, what do you think?

@blueyed
Copy link
Contributor Author

blueyed commented Nov 23, 2018

Added the comment.

(normally I would have pushed this as a fixup with [ci skip], and then it could have been squashed merged, but yeah.. - full CI run now for this..)

@codecov
Copy link

codecov bot commented Nov 23, 2018

Codecov Report

Merging #4399 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4399      +/-   ##
==========================================
+ Coverage   95.87%   95.92%   +0.04%     
==========================================
  Files         111      111              
  Lines       25061    25001      -60     
  Branches     2445     2440       -5     
==========================================
- Hits        24028    23981      -47     
+ Misses        726      723       -3     
+ Partials      307      297      -10
Flag Coverage Δ
#docs 29.93% <16.66%> (-0.13%) ⬇️
#doctesting 29.93% <16.66%> (-0.13%) ⬇️
#linting 29.93% <16.66%> (-0.13%) ⬇️
#linux 95.75% <100%> (+0.04%) ⬆️
#nobyte 92.35% <100%> (-0.31%) ⬇️
#numpy 93.13% <100%> (-0.3%) ⬇️
#pexpect 41.79% <100%> (-0.02%) ⬇️
#py27 94.05% <100%> (+0.04%) ⬆️
#py34 92.17% <100%> (+0.06%) ⬆️
#py35 92.18% <100%> (+0.05%) ⬆️
#py36 92.2% <100%> (+0.05%) ⬆️
#py37 94.12% <100%> (+0.03%) ⬆️
#trial 93.13% <100%> (-0.3%) ⬇️
#windows 94.11% <100%> (-0.01%) ⬇️
#xdist 93.95% <100%> (-0.02%) ⬇️
Impacted Files Coverage Δ
src/_pytest/terminal.py 93.1% <100%> (+1.11%) ⬆️
testing/test_terminal.py 100% <100%> (+0.19%) ⬆️
testing/python/raises.py 93.1% <0%> (-0.5%) ⬇️
src/_pytest/monkeypatch.py 93.75% <0%> (-0.13%) ⬇️
testing/test_tmpdir.py 98.75% <0%> (-0.12%) ⬇️
testing/test_assertrewrite.py 83.38% <0%> (-0.08%) ⬇️
src/_pytest/_code/code.py 95.42% <0%> (-0.05%) ⬇️
src/_pytest/pytester.py 87.41% <0%> (-0.04%) ⬇️
testing/test_session.py 96.5% <0%> (-0.03%) ⬇️
testing/test_cacheprovider.py 99.71% <0%> (-0.02%) ⬇️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b73d6d...0cf45ee. Read the comment docs.

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

how and where to communicate the details is indeed up to taste and api stability

we can think about writing this cleaner as a followup - the decomposition wont be directly oblivious as its indeed a tricky case

@nicoddemus
Copy link
Member

I will get this merged now as we know it has passed in the previous commit, and the only change has been a comment. 😁

Thanks @blueyed!

@nicoddemus nicoddemus merged commit 23e4447 into pytest-dev:master Nov 23, 2018
else:
warnings = all_warnings
self._already_displayed_warnings = len(warnings)

Copy link
Member

Choose a reason for hiding this comment

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

We should move the conditional from the top of the method to this point:

if not warnings:
    return

That's why we are seeing double warnings summary even if the "final" summary has no warnings to show. 👍

blueyed added a commit to nicoddemus/pytest that referenced this pull request Nov 23, 2018
blueyed added a commit to nicoddemus/pytest that referenced this pull request Nov 23, 2018
@blueyed blueyed deleted the summary branch April 7, 2019 23:12
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.

3 participants