Skip to content

Commit

Permalink
Make _hook_into_pytest() work with pytest-4.1
Browse files Browse the repository at this point in the history
This is however not backward compatible with pytest<4.1 since the
runner.CallInfo.from_call() was added in 4.1.0
pytest-dev/pytest@847eace

Fixes flexmock#27
  • Loading branch information
jpopelka committed Jan 7, 2019
1 parent 30def75 commit 5666253
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions flexmock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,8 +1224,7 @@ def call_runtest_hook(item, when, **kwargs):
ret = saved(item, when, **kwargs)
if when != 'call' and ret.excinfo is None:
return ret
teardown = runner.CallInfo(flexmock_teardown, when=when)
teardown.result = None
teardown = runner.CallInfo.from_call(flexmock_teardown, when=when)
if ret.excinfo is not None and teardown.excinfo is None:
teardown.excinfo = ret.excinfo
return teardown
Expand Down

0 comments on commit 5666253

Please sign in to comment.