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

refactor callinfo to simplify ctor magic #4299

Merged
merged 1 commit into from
Nov 30, 2018

Conversation

RonnyPfannschmidt
Copy link
Member

No description provided.

@nicoddemus nicoddemus changed the title refactor callinfo to simplify ctor magic WIP refactor callinfo to simplify ctor magic Nov 9, 2018
@blueyed
Copy link
Contributor

blueyed commented Nov 11, 2018

CI failures appear to be unrelated.
#4366 (comment)
For MacOS py37 rebasing should fix it.

@RonnyPfannschmidt
Copy link
Member Author

Will squash/rebase later today

@nicoddemus PS this is roughly what i want to enable for nodes AS well

@blueyed
Copy link
Contributor

blueyed commented Nov 13, 2018

How is #4292 meant to look with this?

diff --git i/src/_pytest/runner.py w/src/_pytest/runner.py
index 0d6e3dc3..045eb72d 100644
--- i/src/_pytest/runner.py
+++ w/src/_pytest/runner.py
@@ -15,6 +15,7 @@
 from .reports import CollectReport
 from .reports import TestReport
 from _pytest._code.code import ExceptionInfo
+from _pytest.outcomes import Exit
 from _pytest.outcomes import skip
 from _pytest.outcomes import Skipped
 from _pytest.outcomes import TEST_OUTCOME
@@ -190,10 +191,13 @@ def check_interactive_exception(call, report):
 def call_runtest_hook(item, when, **kwds):
     hookname = "pytest_runtest_" + when
     ihook = getattr(item.ihook, hookname)
+    reraise = (Exit,)
+    if not item.config.getvalue("usepdb"):
+        reraise += (KeyboardInterrupt,)
     return CallInfo.from_call(
         lambda: ihook(item=item, **kwds),
         when=when,
-        reraise=KeyboardInterrupt if not item.config.getvalue("usepdb") else (),
+        reraise=reraise,
     )

?

Or would Exit be handled there still further down?

I think this tights Exit and KeyboardInterrupt just a bit more (as it currently stands)?!

@RonnyPfannschmidt
Copy link
Member Author

@blueyed correct - the signaling should be layered differently

@blueyed
Copy link
Contributor

blueyed commented Nov 13, 2018

How then? (please be more verbose)

@blueyed blueyed mentioned this pull request Nov 14, 2018
@RonnyPfannschmidt
Copy link
Member Author

@blueyed my own investigation on that is not finished as the layering and the structure of calls, hooks and nodes is intertwined with this detail issue and its not clear how to layer and integrate them - i took a while to think if something comes to mind, but right no good solution seems to come to it

@blueyed
Copy link
Contributor

blueyed commented Nov 15, 2018

But you would like to keep this PR as is?
Can you then please rebase and get it merged already, so that we can work from there?

(but IMHO given the above diff it does not really make it any better than https://github.com/pytest-dev/pytest/pull/4292/files#diff-4d6d922c3b97a9eae157f8f653627b13 would have done it)

@RonnyPfannschmidt
Copy link
Member Author

thanks for the node, i got sidetracked ^^

@RonnyPfannschmidt
Copy link
Member Author

pushed my squash/rebase - i might have invalidated the repr while in call test and should take a look at removing that again - will do more after i fetched the kid from daycare

@codecov
Copy link

codecov bot commented Nov 15, 2018

Codecov Report

Merging #4299 into features will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##           features    #4299      +/-   ##
============================================
+ Coverage     95.81%   95.83%   +0.02%     
============================================
  Files           111      111              
  Lines         25034    25038       +4     
  Branches       2462     2463       +1     
============================================
+ Hits          23987    23996       +9     
+ Misses          737      735       -2     
+ Partials        310      307       -3
Flag Coverage Δ
#docs 29.31% <60.6%> (+0.12%) ⬆️
#doctesting 29.31% <60.6%> (+0.12%) ⬆️
#linting 29.31% <60.6%> (+0.12%) ⬆️
#linux 95.65% <100%> (ø) ⬆️
#nobyte 92.56% <100%> (ø) ⬆️
#numpy 93.28% <100%> (ø) ⬆️
#pexpect 41.63% <81.81%> (+0.03%) ⬆️
#py27 93.89% <100%> (+0.02%) ⬆️
#py34 92.07% <100%> (+0.06%) ⬆️
#py35 92.09% <100%> (+0.06%) ⬆️
#py36 92.11% <100%> (+0.06%) ⬆️
#py37 94.03% <100%> (+0.02%) ⬆️
#trial 93.28% <100%> (ø) ⬆️
#windows 94.09% <100%> (+0.01%) ⬆️
#xdist 93.94% <100%> (-0.01%) ⬇️
Impacted Files Coverage Δ
src/_pytest/nose.py 97.22% <100%> (ø) ⬆️
src/_pytest/runner.py 97.03% <100%> (+0.12%) ⬆️
testing/test_runner.py 96.88% <100%> (-0.05%) ⬇️
src/_pytest/terminal.py 92.95% <0%> (+0.83%) ⬆️

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 b531f7d...847eace. Read the comment docs.

@RonnyPfannschmidt
Copy link
Member Author

yup, had to take it out again

@RonnyPfannschmidt RonnyPfannschmidt changed the title WIP refactor callinfo to simplify ctor magic refactor callinfo to simplify ctor magic Nov 15, 2018
assert ci.when == "123"
assert ci.result == 0
assert "result" in repr(ci)
assert repr(ci) == "<CallInfo when='123' result: 0>"
ci = runner.CallInfo.from_call(lambda: 0 / 0, "123")
Copy link
Contributor

Choose a reason for hiding this comment

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

This test should not be changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch

testing/test_runner.py Show resolved Hide resolved
@RonnyPfannschmidt RonnyPfannschmidt changed the title refactor callinfo to simplify ctor magic WIP refactor callinfo to simplify ctor magic Nov 15, 2018
@RonnyPfannschmidt
Copy link
Member Author

appveyor is codecov related

@RonnyPfannschmidt RonnyPfannschmidt changed the title WIP refactor callinfo to simplify ctor magic refactor callinfo to simplify ctor magic Nov 22, 2018
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.

LGTM

src/_pytest/runner.py Show resolved Hide resolved
@nicoddemus
Copy link
Member

@RonnyPfannschmidt this is conflicting with the recent merge for ExceptionInfo, could you please take a look when you get the chance?

@RonnyPfannschmidt RonnyPfannschmidt changed the title refactor callinfo to simplify ctor magic WIP: refactor callinfo to simplify ctor magic Nov 23, 2018
@RonnyPfannschmidt
Copy link
Member Author

will do so either in the late afternoon or tommorow

@RonnyPfannschmidt RonnyPfannschmidt changed the title WIP: refactor callinfo to simplify ctor magic refactor callinfo to simplify ctor magic Nov 30, 2018
@nicoddemus nicoddemus merged commit e0ba1cb into pytest-dev:features Nov 30, 2018
@RonnyPfannschmidt RonnyPfannschmidt deleted the callinfo-sanity branch January 20, 2019 13:11
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.

None yet

3 participants