Skip to content

Commit

Permalink
Merge pull request #1614 from gnprice/loop
Browse files Browse the repository at this point in the history
Simplify default pytest_runtestloop
  • Loading branch information
nicoddemus authored Jun 16, 2016
2 parents 66e66f6 + ab8b2e7 commit c542464
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Floris Bruynooghe
Gabriel Reis
Georgy Dyuldin
Graham Horler
Greg Price
Grig Gheorghiu
Guido Wesdorp
Harald Armin Massa
Expand Down
11 changes: 1 addition & 10 deletions _pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,8 @@ def pytest_runtestloop(session):
if session.config.option.collectonly:
return True

def getnextitem(i):
# this is a function to avoid python2
# keeping sys.exc_info set when calling into a test
# python2 keeps sys.exc_info till the frame is left
try:
return session.items[i+1]
except IndexError:
return None

for i, item in enumerate(session.items):
nextitem = getnextitem(i)
nextitem = session.items[i+1] if i+1 < len(session.items) else None
item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
if session.shouldstop:
raise session.Interrupted(session.shouldstop)
Expand Down

0 comments on commit c542464

Please sign in to comment.