From a9b7de8bf0236de9f421c603f1e2e201777735d0 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Sat, 21 Mar 2015 17:26:23 +0100 Subject: [PATCH] address reviewer comments --- doc/en/usage.txt | 12 ++++++++++-- testing/test_runner.py | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/en/usage.txt b/doc/en/usage.txt index 4931e7086..e774ebef6 100644 --- a/doc/en/usage.txt +++ b/doc/en/usage.txt @@ -88,8 +88,16 @@ failure situation:: py.test --pdb --maxfail=3 # drop to PDB for first three failures Note that on any failure the exception information is stored on -``sys.last_traceback``. In interactive use, this allows one to drop -into postmortem debugging with any debug tool. +``sys.last_value``, ``sys.last_type`` and ``sys.last_traceback``. In +interactive use, this allows one to drop into postmortem debugging with +any debug tool. One can also manually access the exception information, +for example:: + + >> import sys + >> sys.last_traceback.tb_lineno + 42 + >> sys.last_value + AssertionError('assert result == "ok"',) Setting a breakpoint / aka ``set_trace()`` ---------------------------------------------------- diff --git a/testing/test_runner.py b/testing/test_runner.py index fee1be09b..e62aea9f7 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -527,7 +527,10 @@ def test_makereport_getsource(testdir): result.stdout.fnmatch_lines(['*else: assert False*']) -def test_store_except_info_on_eror(testdir): +def test_store_except_info_on_eror(): + """ Test that upon test failure, the exception info is stored on + sys.last_traceback and friends. + """ # Simulate item that raises a specific exception class ItemThatRaises: def runtest(self):