1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/7ae546be7b31/ changeset: 7ae546be7b31 user: RonnyPfannschmidt date: 2012-09-15 15:20:49 summary: fix issue 188 - ensure sys.exc_info on py2 is clear before calling into a test affected #: 3 files diff -r a5e7a5fa3c7e8aef9306f60c9e0d42c01e4252c7 -r 7ae546be7b31ac1fb585dbfb85771ac194e2d72c CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -56,6 +56,9 @@ - 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: - pytest_report_header now receives a "startdir" so that diff -r a5e7a5fa3c7e8aef9306f60c9e0d42c01e4252c7 -r 7ae546be7b31ac1fb585dbfb85771ac194e2d72c _pytest/main.py --- a/_pytest/main.py +++ b/_pytest/main.py @@ -114,11 +114,18 @@ 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): - try: - nextitem = session.items[i+1] - except IndexError: - nextitem = None + nextitem = getnextitem(i) item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) if session.shouldstop: raise session.Interrupted(session.shouldstop) diff -r a5e7a5fa3c7e8aef9306f60c9e0d42c01e4252c7 -r 7ae546be7b31ac1fb585dbfb85771ac194e2d72c testing/test_runner.py --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -180,7 +180,12 @@ raise Exception() 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): raise ValueError(42) """) Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn