GNU bug report logs - #9803
Add ERT option to skip test

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Thu, 20 Oct 2011 03:44:02 UTC

Severity: wishlist

Found in version 24.0.90

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #12 received at 9803 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 9803 <at> debbugs.gnu.org
Subject: Re: bug#9803: [PATCH] Add ERT option to skip test
Date: Fri, 18 Oct 2013 21:02:45 -0400
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




This bug report was last modified 11 years and 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.