emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 4e85910 088/215: Add pytest error message pattern in pytho


From: Rocky Bernstein
Subject: [elpa] master 4e85910 088/215: Add pytest error message pattern in python debuggers
Date: Sat, 30 Jul 2016 14:48:56 +0000 (UTC)

branch: master
commit 4e85910b106e3094d2b27ac34f584df5bf4ab457
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Add pytest error message pattern in python debuggers
---
 realgud/debugger/pdb/init.el      |    4 ++++
 realgud/debugger/trepan2/init.el  |    4 ++++
 realgud/debugger/trepan3k/init.el |    4 ++++
 realgud/lang/python.el            |   18 ++++++++++++++++++
 4 files changed, 30 insertions(+)

diff --git a/realgud/debugger/pdb/init.el b/realgud/debugger/pdb/init.el
index dfcb765..4ad8230 100644
--- a/realgud/debugger/pdb/init.el
+++ b/realgud/debugger/pdb/init.el
@@ -57,6 +57,10 @@ realgud-loc-pat struct")
 (setf (gethash "lang-backtrace" realgud:pdb-pat-hash)
       realgud-python-backtrace-loc-pat)
 
+;;  Regular expression that describes location in a pytest error
+(setf (gethash "pytest-error" realgud:pdb-pat-hash)
+      realgud-pytest-error-loc-pat)
+
 ;;  Regular expression that describes a "breakpoint set" line. For example:
 ;;     Breakpoint 1 at /usr/bin/pdb:7
 (setf (gethash "brkpt-set" realgud:pdb-pat-hash)
diff --git a/realgud/debugger/trepan2/init.el b/realgud/debugger/trepan2/init.el
index 24f239d..9fb9fec 100644
--- a/realgud/debugger/trepan2/init.el
+++ b/realgud/debugger/trepan2/init.el
@@ -53,6 +53,10 @@ realgud-loc-pat struct")
 (setf (gethash "lang-backtrace" realgud:trepan2-pat-hash)
       realgud-python-backtrace-loc-pat)
 
+;;  Regular expression that describes location in a pytest error
+(setf (gethash "pytest-error" realgud:trepan2-pat-hash)
+      realgud-pytest-error-loc-pat)
+
 ;;  Regular expression that describes a "breakpoint set" line
 (setf (gethash "brkpt-set" realgud:trepan2-pat-hash)
       realgud:python-trepan-brkpt-set-pat)
diff --git a/realgud/debugger/trepan3k/init.el 
b/realgud/debugger/trepan3k/init.el
index d555ed9..b9d8f2a 100644
--- a/realgud/debugger/trepan3k/init.el
+++ b/realgud/debugger/trepan3k/init.el
@@ -51,6 +51,10 @@ realgud-loc-pat struct")
 (setf (gethash "lang-backtrace" realgud:trepan3k-pat-hash)
       realgud-python-backtrace-loc-pat)
 
+;;  Regular expression that describes location in a pytest error
+(setf (gethash "pytest-error" realgud:trepan3k-pat-hash)
+      realgud-pytest-error-loc-pat)
+
 ;;  Regular expression that describes a "breakpoint set" line
 (setf (gethash "brkpt-set" realgud:trepan3k-pat-hash)
       realgud:python-trepan-brkpt-set-pat)
diff --git a/realgud/lang/python.el b/realgud/lang/python.el
index 21190c7..e3ae1cf 100644
--- a/realgud/lang/python.el
+++ b/realgud/lang/python.el
@@ -6,6 +6,8 @@
 (require-relative-list '("../common/regexp" "../common/loc" "../common/track")
                       "realgud-")
 
+(declare-function realgud-goto-line-for-pt 'realgud-track)
+
 (defconst realgud-python-backtrace-loc-pat
   (make-realgud-loc-pat
    :regexp "^[ \t]+File \"\\(.+\\)\", line \\([0-9]+\\)"
@@ -25,6 +27,7 @@ traceback) line."  )
 \\{realgud-example-map-standard}"
   (define-key map (kbd "C-c !b") 'realgud:goto-debugger-backtrace-line)
   (define-key map (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
+  (define-key map (kbd "C-c !e") 'realgud:pytest-goto-errmsg-line)
   )
 
 
@@ -121,6 +124,21 @@ traceback) line."  )
     ;;  (0 trepan2-frames-current-frame-face append))
     ))
 
+(defconst realgud-pytest-error-loc-pat
+  (make-realgud-loc-pat
+   :regexp "^\\(.*\\):\\([0-9]+\\): in "
+   :file-group 1
+   :line-group 2)
+  "A realgud-loc-pat struct that describes a Pytest error line"
+  )
+
+
+;; FIXME: there is probably a less redundant way to do the following
+;; FNS.
+(defun realgud:pytest-goto-errmsg-line (pt)
+  "Display the location mentioned by the pytest error at PT."
+  (interactive "d")
+  (realgud-goto-line-for-pt pt "pytest-error"))
 
 
 (provide-me "realgud-lang-")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]