[Pytest-commit] commit/pytest: RonnyPfannschmidt: move pdb plugin post morten traceback selection to a own function

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Apr 16 08:47:29 CEST 2013


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/1e37dc2b23fe/
Changeset:   1e37dc2b23fe
User:        RonnyPfannschmidt
Date:        2013-04-16 08:46:55
Summary:     move pdb plugin post morten traceback selection to a own function

this is preparation for making it resillent against broken envs
that can't import doctest
Affected #:  1 file

diff -r 82139da07b58da52fc124be4218c8957b71f3ac1 -r 1e37dc2b23fe92b81da6be1c4b6bde2025ee4f1b _pytest/pdb.py
--- a/_pytest/pdb.py
+++ b/_pytest/pdb.py
@@ -70,16 +70,21 @@
         tw.sep(">", "traceback")
         rep.toterminal(tw)
         tw.sep(">", "entering PDB")
-        # A doctest.UnexpectedException is not useful for post_mortem.
-        # Use the underlying exception instead:
-        if isinstance(call.excinfo.value, py.std.doctest.UnexpectedException):
-            tb = call.excinfo.value.exc_info[2]
-        else:
-            tb = call.excinfo._excinfo[2]
+
+        tb = self._postmortem_traceback(call.excinfo)
         post_mortem(tb)
         rep._pdbshown = True
         return rep
 
+    @staticmethod
+    def _postmortem_traceback(excinfo):
+        # A doctest.UnexpectedException is not useful for post_mortem.
+        # Use the underlying exception instead:
+        if isinstance(excinfo.value, py.std.doctest.UnexpectedException):
+            return excinfo.value.exc_info[2]
+        else:
+            return excinfo._excinfo[2]
+
 def post_mortem(t):
     pdb = py.std.pdb
     class Pdb(pdb.Pdb):

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.


More information about the pytest-commit mailing list