merge
This commit is contained in:
commit
f6b555f5ad
|
@ -56,6 +56,9 @@ Changes between 2.2.4 and 2.3.0.dev
|
||||||
|
|
||||||
- fix issue 182: testdir.inprocess_run now considers passed plugins
|
- fix issue 182: testdir.inprocess_run now considers passed plugins
|
||||||
|
|
||||||
|
- fix issue 188: ensure sys.exc_info is clear on python2
|
||||||
|
before calling into a test
|
||||||
|
|
||||||
- reporting refinements:
|
- reporting refinements:
|
||||||
|
|
||||||
- pytest_report_header now receives a "startdir" so that
|
- pytest_report_header now receives a "startdir" so that
|
||||||
|
|
|
@ -114,11 +114,18 @@ def pytest_collection(session):
|
||||||
def pytest_runtestloop(session):
|
def pytest_runtestloop(session):
|
||||||
if session.config.option.collectonly:
|
if session.config.option.collectonly:
|
||||||
return True
|
return True
|
||||||
for i, item in enumerate(session.items):
|
|
||||||
|
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:
|
try:
|
||||||
nextitem = session.items[i+1]
|
return session.items[i+1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
nextitem = None
|
return None
|
||||||
|
|
||||||
|
for i, item in enumerate(session.items):
|
||||||
|
nextitem = getnextitem(i)
|
||||||
item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
|
item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
|
||||||
if session.shouldstop:
|
if session.shouldstop:
|
||||||
raise session.Interrupted(session.shouldstop)
|
raise session.Interrupted(session.shouldstop)
|
||||||
|
|
|
@ -180,7 +180,12 @@ class BaseFunctionalTests:
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
def test_func():
|
def test_func():
|
||||||
pass
|
import sys
|
||||||
|
# on python2 exc_info is keept till a function exits
|
||||||
|
# so we would end up calling test functions while
|
||||||
|
# sys.exc_info would return the indexerror
|
||||||
|
# from guessing the lastitem
|
||||||
|
assert sys.exc_info()[0] is None
|
||||||
def teardown_function(func):
|
def teardown_function(func):
|
||||||
raise ValueError(42)
|
raise ValueError(42)
|
||||||
""")
|
""")
|
||||||
|
|
Loading…
Reference in New Issue