From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#9803: [PATCH] Add ERT option to skip test Date: Fri, 18 Oct 2013 21:02:45 -0400 Message-ID: References: <87vc0usnrj.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1382144586 19485 80.91.229.3 (19 Oct 2013 01:03:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Oct 2013 01:03:06 +0000 (UTC) Cc: 9803@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 19 03:03:09 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VXKwf-0004fQ-9Z for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Oct 2013 03:03:09 +0200 Original-Received: from localhost ([::1]:59897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXKwe-00037k-GH for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Oct 2013 21:03:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXKwa-00037Y-JW for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:03:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXKwY-00017U-Sm for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:03:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXKwY-00017O-Q2 for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VXKwY-0007hq-K2 for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2013 01:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9803 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9803-submit@debbugs.gnu.org id=B9803.138214457029602 (code B ref 9803); Sat, 19 Oct 2013 01:03:02 +0000 Original-Received: (at 9803) by debbugs.gnu.org; 19 Oct 2013 01:02:50 +0000 Original-Received: from localhost ([127.0.0.1]:57417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXKwL-0007hN-Rk for submit@debbugs.gnu.org; Fri, 18 Oct 2013 21:02:50 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:37716 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXKwJ-0007hD-36 for 9803@debbugs.gnu.org; Fri, 18 Oct 2013 21:02:47 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VXKwH-00065V-U3; Fri, 18 Oct 2013 21:02:45 -0400 X-Spook: Ansar al-Islam terrorism pipeline Cocaine fissionable X-Ran: ,Y+Vf7'vj!W[MBo(UAzj]wNIQA7mBqT/YjG7Wi}A]Y_XW4C7rQV?w6 (Michael Albinus's message of "Fri, 18 Oct 2013 15:37:52 +0200") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79378 Archived-At: 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