From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 4/4] t/README: Update "Skipping tests" to align with best practices
Date: Tue, 27 Jul 2010 21:14:14 +0000 [thread overview]
Message-ID: <1280265254-19642-6-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1280265254-19642-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-27 21:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 21:14 [PATCH 0/4] Skip tests using 3-arg test_* Ævar Arnfjörð Bjarmason
2010-07-27 21:14 ` [PATCH 1/4] tests: implicitly skip SYMLINKS tests using <prereq> Ævar Arnfjörð Bjarmason
2010-07-27 21:17 ` Jonathan Nieder
2010-07-27 21:14 ` [PATCH 1/4] t: " Ævar Arnfjörð Bjarmason
2010-07-27 22:23 ` Sverre Rabbelier
2010-07-27 21:14 ` [PATCH 2/4] t/t5800-remote-helpers.sh: Skip with prereq on python <2.4 Ævar Arnfjörð Bjarmason
2010-07-27 21:14 ` [PATCH 3/4] t/t7800-difftool.sh: Skip with prereq on no PERL Ævar Arnfjörð Bjarmason
2010-07-27 21:14 ` Æ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=1280265254-19642-6-git-send-email-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.