unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 9803@debbugs.gnu.org
Subject: bug#9803: [PATCH] Add ERT option to skip test
Date: Fri, 18 Oct 2013 21:02:45 -0400	[thread overview]
Message-ID: <sw1u3ihy2y.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87vc0usnrj.fsf@gmx.de> (Michael Albinus's message of "Fri, 18 Oct 2013 15:37:52 +0200")

Michael Albinus wrote:

>> I think it would be nice if ert had the ability to skip tests.
>> Eg, a :skip argument that works the same way as :expected-result.
[...]
> I have written a new macro, which should do the job. It is called
> `skip-if' and works like `should' and companions. You pass a form as
> argument, and when it returns non-nil the test is skipped.

Thank you, looks nice.
Your method is not quite how I imagined it working, but maybe your way is
better, I haven't thought about it much... With your approach, it seems
like I have to specify the skip condition twice? Eg I have to write:

(ert-deftest foo-test ()
  "Test for foo."
  :expected-result (if (executable-find "foo") :passed :skipped)
  (skip-if (not (executable-find "foo")))
  t ; in a real use case, some test using "foo" here
)

rather than:

(ert-deftest foo-test ()
  "Test for foo."
  :skip (not (executable-find "foo"))
  t)


I think `skip-if' should have an ert- prefix. (I know `should' doesn't,
but I think it, err, should as well. But too late for that one now.)


Also, ert-run-tests-batch-and-exit seems to need updating:

  Running 1 tests (2013-10-18 17:49:11-0700)
    skipped  1/1  foo-test

  Ran 1 tests, 0 results as expected (2013-10-18 17:49:11-0700)

I don't think "0 results as expected" is appropriate.

Eg automake uses a summary like this:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11745





  reply	other threads:[~2013-10-19  1:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  3:42 bug#9803: Add ERT option to skip test Glenn Morris
2013-07-04 18:40 ` Michael Albinus
2013-10-18 13:37 ` bug#9803: [PATCH] " Michael Albinus
2013-10-19  1:02   ` Glenn Morris [this message]
2013-10-19  2:12     ` Stefan Monnier
2013-10-19  6:44       ` Michael Albinus
2013-10-19  6:44     ` Michael Albinus
2013-10-20  2:02       ` Glenn Morris
2013-10-20 14:09     ` Michael Albinus
2013-10-21 15:08       ` Michael Albinus
2013-10-21 16:53         ` Stefan Monnier
2013-10-21 17:02           ` Michael Albinus
2013-10-21 19:23             ` Stefan Monnier
2013-10-22  8:23               ` Michael Albinus
2013-10-23 12:21                 ` Michael Albinus
2013-10-24  7:46                   ` Michael Albinus
2013-10-24  8:00                     ` Glenn Morris

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=sw1u3ihy2y.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=9803@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /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).