Doug MacEachern wrote:


People already start complaining because they don't know why this or that test gets skipped, but they are techy enough to look at the code to figure out. Once we release Apache-Test, many people won't know to figure out why some tests are skipped. Therefore I've tried to solve this, so if I require have_module Chatbot::Eliza1 I get:


i like the idea of hinting why a test is skipped. only thing is "Missing foo" might not be very informative, for example the tests that run against c-modules. none of the c-modules will be "missing", but they might not be built because:

- apxs is not available
- the module requires 2.0
- etc

"missing mod_echo_post" won't be very helpful in that case.

then there are tests that are skipped unless 'have_apache 2.0',
'have_perl "ithreads"', etc.

maybe just extend your patch so a .t can define:
$Apache::Test::SkipReason = 'requires apxs and apache-2.0';

and the skip code does this:
            my $real_reason = $Apache::Test::SkipReason || $reason;
            print "1..0 # skipped: $real_reason \n";

since each .t has its own process, there won't be a clash using the
$Apache::TestSkip::Reason variable.


That's not very clean. You don't do the test for prerequisites in .t, you only specify the prerequisites in the test and delegate the test to Apache::Test::plan(). So if .t specifies 3 things as prerequisites and only one is satisfied you don't want to report all three as a reason for skip, but only the one that's is not satisfied. Therefore you don't know what to set in $Apache::Test::SkipReason in non-simple cases.

Which means that we either should move the actual prerequisites testing contol into .t's, then you can let .t to see what's not satisfied and set $Apache::Test::SkipReason. Or we should fix all the have_ functions to follow my example patch, to return {$meet_condition => $reason}. In the later case each have_ function can say properly the reason for a skip, not just missing.



_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Reply via email to