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

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

[elpa] externals/dape 8632214a6b: Cleanup processes on test failure


From: ELPA Syncer
Subject: [elpa] externals/dape 8632214a6b: Cleanup processes on test failure
Date: Fri, 12 Jan 2024 13:04:18 -0500 (EST)

branch: externals/dape
commit 8632214a6badeb84554810685e95c0bafbf9a40a
Author: Daniel Pettersson <daniel@dpettersson.net>
Commit: Daniel Pettersson <daniel@dpettersson.net>

    Cleanup processes on test failure
---
 dape-tests.el | 45 +++++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/dape-tests.el b/dape-tests.el
index 86c1444b9a..0d9d938ec7 100644
--- a/dape-tests.el
+++ b/dape-tests.el
@@ -92,25 +92,30 @@ Helper for `dape-test--with-files'."
       (unless dape-test--skip-cleanup
         (advice-add 'yes-or-no-p :around (defun always-yes (&rest _) t))
         (dape-quit)
-        (setq dape--info-expanded-p
-              (make-hash-table :test 'equal))
-        (setq dape--watched nil)
-        (dape-test--should
-         (not (dape--live-connection t)) 10)
-        (dape-test--should
-         (not (seq-find (lambda (buffer)
-                          (and (not (equal (buffer-name buffer)
-                                           "*dape-connection events*"))
-                               (string-match-p "\\*dape-.+\\*"
-                                               (buffer-name buffer))))
-                        (buffer-list))))
-        (dape-test--should
-         (not (process-list)) 10)
-        (advice-remove 'yes-or-no-p 'always-yes)
-        (dolist (buffer buffers)
-          (kill-buffer buffer))
-        ;; clean up files
-        (delete-directory temp-dir t)))))
+        (unwind-protect
+            ;; Post test asserts
+            (progn
+              (dape-test--should
+               (not (dape--live-connection t)) 10)
+              (dape-test--should
+               (not (seq-find (lambda (buffer)
+                                (and (not (equal (buffer-name buffer)
+                                                 "*dape-connection events*"))
+                                     (string-match-p "\\*dape-.+\\*"
+                                                     (buffer-name buffer))))
+                              (buffer-list))))
+              (dape-test--should
+               (not (process-list)) 10))
+          (advice-remove 'yes-or-no-p 'always-yes)
+          (setq dape--info-expanded-p
+                (make-hash-table :test 'equal))
+          (setq dape--watched nil)
+          (dolist (process (process-list))
+            (delete-process process))
+          (dolist (buffer buffers)
+            (kill-buffer buffer))
+          ;; clean up files
+          (delete-directory temp-dir t))))))
 
 (defun dape-test--apply-to-match (regex fn)
   "Apply FN to match of REGEX in the current buffer."
@@ -215,7 +220,7 @@ Expects line with string \"breakpoint\" in source."
      (and (dape-test--stopped-p)
           (equal (line-number-at-pos)
                  (dape-test--line-at-regex "breakpoint"))))
-    (sleep-for 2) ;; FIXME Regression dape messes up current live connection
+    (sleep-for 3) ;; FIXME Regression dape messes up current live connection
                   ;; on fast restarts
     ;; restart
     (goto-char (point-min))



reply via email to

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