Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Skipping tests if a module is not availableby Jeffrey Kegler (Hermit) |
on Oct 31, 2007 at 02:44 UTC ( [id://648163]=perlquestion: print w/replies, xml ) | Need Help?? |
Jeffrey Kegler has asked for the wisdom of the Perl Monks concerning the following question:
My question is in the context of testing modules using Test::More and Test::Harness. Let's suppose you want to write a test to use a CPAN module (not the module being tested), but if it's not available on the site where the test is run, to gently skip one or more tests (up to or including every test in the script).
use_ok() does not seem to be the answer. It's a test in itself, which I don't want. It seems aimed at loading the module to be tested, not a module to be used for the test. It seems a simple enough task, but I get very perplexing results. Trying this sample test script
But using the test target of an ExtUtils-MakeMaker generated Makefile, I get: Seems as if Test::Harness can't find a VERSION number which a raw perl command had no trouble finding. (If you suspect I'm doing something wrong in Test::Weaken 0.002002, it's on CPAN for your inspection.) I've tried some eval trickery, but that this problem with the mysterious disappearing VERSION number so far has defeated me.
Back to
Seekers of Perl Wisdom
|
|