GNU bug report logs -
#16853
24.3.50; ert-run-tests-interactively difficult to abort
Previous Next
Reported by: Helmut Eller <eller.helmut <at> gmail.com>
Date: Sun, 23 Feb 2014 14:50:02 UTC
Severity: wishlist
Tags: fixed, patch
Found in version 24.3.50
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sun, Feb 23 2014, Helmut Eller wrote:
> I need to press C-g five times before ERT finally stops.
>
> It would be much less annoying if ERT would quit after the first C-g.
> This is especially important for test suites with more than 100 tests.
Here is a patch to fix this:
Make it easier to abort a series of tests with C-g.
* emacs-lisp/ert.el (ert-run-tests): Add "interactively" arg. If
interactively is true and a test was aborted then ask if the
remaining tests should be aborted too.
(ert-run-tests-batch, ert-run-tests-interactively): Pass in
interactively arg.
[x.patch (text/x-diff, inline)]
diff --git lisp/emacs-lisp/ert.el lisp/emacs-lisp/ert.el
index 34041aa..aa01c3f 100644
--- lisp/emacs-lisp/ert.el
+++ lisp/emacs-lisp/ert.el
@@ -1238,7 +1238,7 @@ SELECTOR is the selector that was used to select TESTS."
(funcall listener 'test-ended stats test result))
(setf (ert--stats-current-test stats) nil))))
-(defun ert-run-tests (selector listener)
+(defun ert-run-tests (selector listener interactively)
"Run the tests specified by SELECTOR, sending progress updates to LISTENER."
(let* ((tests (ert-select-tests selector t))
(stats (ert--make-stats tests selector)))
@@ -1249,10 +1249,14 @@ SELECTOR is the selector that was used to select TESTS."
(let ((ert--current-run-stats stats))
(force-mode-line-update)
(unwind-protect
- (progn
- (cl-loop for test in tests do
- (ert-run-or-rerun-test stats test listener))
- (setq abortedp nil))
+ (cl-loop for test in tests do
+ (ert-run-or-rerun-test stats test listener)
+ (when (and interactively
+ (ert-test-quit-p
+ (ert-test-most-recent-result test))
+ (y-or-n-p "Abort testing? "))
+ (cl-return))
+ finally (setq abortedp nil))
(setf (ert--stats-aborted-p stats) abortedp)
(setf (ert--stats-end-time stats) (current-time))
(funcall listener 'run-ended stats abortedp)))
@@ -1443,7 +1447,8 @@ Returns the stats object."
(ert-test-result-expected-p
test result))
(1+ (ert--stats-test-pos stats test))
- (ert-test-name test)))))))))
+ (ert-test-name test)))))))
+ nil))
;;;###autoload
(defun ert-run-tests-batch-and-exit (&optional selector)
@@ -1952,9 +1957,8 @@ and how to display message."
test result)))
(ert--results-update-stats-display-maybe ewoc stats)
(ewoc-invalidate ewoc node))))))))
- (ert-run-tests
- selector
- listener)))
+ (ert-run-tests selector listener t)))
+
;;;###autoload
(defalias 'ert 'ert-run-tests-interactively)
This bug report was last modified 8 years and 55 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.