From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2 5/5] t/README: Update "Skipping tests" to align with best practices
Date: Wed, 28 Jul 2010 10:34:59 +0000 [thread overview]
Message-ID: <1280313299-721-6-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1280313299-721-1-git-send-email-avarab@gmail.com>
The example I initially added to "Skipping tests" wasn't very
good. We'd rather skip tests using the three-arg prereq form to the
test_* functions, not bail out with a skip message.
Change the documentation to reflect that, but retain the bailout
example under a disclaimer which explains that it's probably not a
good idea to use it.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
t/README | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/t/README b/t/README
index 0d1183c..12b714b 100644
--- a/t/README
+++ b/t/README
@@ -307,9 +307,21 @@ Keep in mind:
Skipping tests
--------------
-If you need to skip all the remaining tests you should set skip_all
-and immediately call test_done. The string you give to skip_all will
-be used as an explanation for why the test was skipped. for instance:
+If you need to skip tests you should do so be using the three-arg form
+of the test_* functions (see the "Test harness library" section
+below), e.g.:
+
+ test_expect_success PERL 'I need Perl' "
+ '$PERL_PATH' -e 'hlagh() if unf_unf()'
+ "
+
+The advantage of skipping tests like this is that platforms that don't
+have the PERL and other optional dependencies get an indication of how
+many tests they're missing.
+
+If the test code is too hairy for that (i.e. does a lot of setup work
+outside test assertions) you can also skip all remaining tests by
+setting skip_all and immediately call test_done:
if ! test_have_prereq PERL
then
@@ -317,6 +329,9 @@ be used as an explanation for why the test was skipped. for instance:
test_done
fi
+The string you give to skip_all will be used as an explanation for why
+the test was skipped.
+
End with test_done
------------------
--
1.7.0.4
prev parent reply other threads:[~2010-07-28 10:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 10:34 [PATCH v2 0/5] Skip tests using 3-arg test_* Ævar Arnfjörð Bjarmason
2010-07-28 10:34 ` [PATCH v2 1/5] tests: implicitly skip SYMLINKS tests using <prereq> Ævar Arnfjörð Bjarmason
2010-07-29 1:00 ` Jonathan Nieder
2010-07-28 10:34 ` [PATCH v2 2/5] t/t4004-diff-rename-symlink.sh: use three-arg <prereq> Ævar Arnfjörð Bjarmason
2010-07-29 1:09 ` Jonathan Nieder
2010-07-29 1:56 ` Ævar Arnfjörð Bjarmason
2010-07-28 10:34 ` [PATCH v2 3/5] t/t5800-remote-helpers.sh: Skip with prereq on python <2.4 Ævar Arnfjörð Bjarmason
2010-07-29 1:16 ` Jonathan Nieder
2010-07-29 2:03 ` Ævar Arnfjörð Bjarmason
2010-07-28 10:34 ` [PATCH v2 4/5] t/t7800-difftool.sh: Skip with prereq on no PERL Ævar Arnfjörð Bjarmason
2010-07-28 10:34 ` Ævar Arnfjörð Bjarmason [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280313299-721-6-git-send-email-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@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.
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 NNTP newsgroup(s).