2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/1597879eb115/ Changeset: 1597879eb115 User: RonnyPfannschmidt Date: 2013-04-16 10:18:08 Summary: turn the postmortem traceback selection to a function Affected #: 1 file
diff -r e648b0ab9f006799cce2e4ed229eec9d3a26a9c0 -r 1597879eb1156057925b4656be0ad61b24e73fe7 _pytest/pdb.py --- a/_pytest/pdb.py +++ b/_pytest/pdb.py @@ -71,19 +71,20 @@ rep.toterminal(tw) tw.sep(">", "entering PDB") - tb = self._postmortem_traceback(call.excinfo) + tb = _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 _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 https://bitbucket.org/hpk42/pytest/commits/ed380ceafe15/ Changeset: ed380ceafe15 User: RonnyPfannschmidt Date: 2013-04-16 10:19:20 Summary: charify pdb visible stack end finding by turning it into a function Affected #: 1 file diff -r 1597879eb1156057925b4656be0ad61b24e73fe7 -r ed380ceafe15f379bc310d1cd43296e0983c6b75 _pytest/pdb.py --- a/_pytest/pdb.py +++ b/_pytest/pdb.py @@ -86,15 +86,20 @@ return excinfo._excinfo[2] +def _find_last_non_hidden_frame(stack): + i = max(0, len(stack) - 1) + while i and stack[i][0].f_locals.get("__tracebackhide__", False): + i -= 1 + return i + + def post_mortem(t): pdb = py.std.pdb class Pdb(pdb.Pdb): def get_stack(self, f, t): stack, i = pdb.Pdb.get_stack(self, f, t) if f is None: - i = max(0, len(stack) - 1) - while i and stack[i][0].f_locals.get("__tracebackhide__", False): - i-=1 + i = _find_last_non_hidden_frame(stack) return stack, i p = Pdb() p.reset() 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. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit