From: Lars Ingebrigtsen <larsi@gnus.org>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: 16853@debbugs.gnu.org
Subject: bug#16853: 24.3.50; ert-run-tests-interactively difficult to abort
Date: Wed, 24 Feb 2016 14:07:53 +1100 [thread overview]
Message-ID: <87k2lun6uu.fsf@gnus.org> (raw)
In-Reply-To: <m2txbgd35m.fsf@gmail.com> (Helmut Eller's message of "Sun, 02 Mar 2014 16:35:33 +0100")
Helmut Eller <eller.helmut@gmail.com> writes:
> 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.
I think this makes sense, but the discussion seemed to go off on a
tangent, and the patch wasn't applied.
And I'm not familiar with the ert internals, but could somebody look at
the patch and see whether it looks reasonable?
> 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)
>
>
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2016-02-24 3:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-23 14:48 bug#16853: 24.3.50; ert-run-tests-interactively difficult to abort Helmut Eller
2014-03-02 15:35 ` Helmut Eller
2016-02-24 3:07 ` Lars Ingebrigtsen [this message]
2017-03-17 2:45 ` npostavs
2017-03-25 0:15 ` npostavs
2014-09-07 10:24 ` Helmut Eller
2014-09-07 19:54 ` Andreas Röhler
2014-09-07 20:37 ` Helmut Eller
2014-09-08 9:29 ` Andreas Röhler
2014-09-08 14:02 ` Helmut Eller
2014-09-08 16:23 ` Andreas Röhler
2014-09-09 13:30 ` Eli Zaretskii
2014-09-09 13:45 ` Helmut Eller
2014-09-09 13:57 ` Eli Zaretskii
2014-09-09 14:14 ` Helmut Eller
2014-09-09 14:41 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2lun6uu.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=16853@debbugs.gnu.org \
--cc=eller.helmut@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).