Recently, I've taken the habit (not in my CPAN modules, though) to add the following snippet at the beginning of all my test scripts:
BEGIN {
eval { require Test::More; }; # and other Test:: modules
print "1..0 # Skip Test::More missing\n", exit if $@;
}
This is because I do not expect the people who install those modules/scripts to run the test suite, and I don't want the installation process to whine about Test::More missing (if it's in the Makefile.PL) and stop and sulk.
I think that the Test:: modules should not be part of the prerequisites for using a module. Am I right?
Test::More - don't leave home without it (Score:1)
As dependencies go, isn't Test::More pure Perl, so it should install everywhere without problem?
module prerequisites (Score:2)
PREREQ_PMdespite the ubiquity ofTest::More- there is a large difference between the test environment and the code itself, and making it impossible to build and install a module when test environment dependencies are missing just seems wrong.but another solution to using a
BEGINblock in each test file is to override thetesttarget in theMakefileby crUsing the module (Score:2)
If you can't run the tests, then how do you know that your users can actually use the module?
--
xoa
Re:Using the module (Score:2)
Re:Using the module (Score:2)
In fact, the conclusion came to me after posting that entry:
I've just been told (hi Maddingue [perl.org]!) that Module::Build [cpan.org] allows this (well build_requires is not quite the same as a test_requires, but probably close enough).
Test scripts prereqs (Score:1)
build_requiresin Build.PL but for the tests only:tests_requires. Maybe you could ask Ken Williams to add this for the next release of Module::Build?Close the world. txEn eht nepO
I say make it a dependency (Score:2)
I think Test::Simple should be marked as a dependency. It really is needed to run the basic tests to confirm the module works. If you need other more esoteric Test::* modules then test scripts which degrade gracefully may be a good idea. Unfortunately, that would not allow you to take the fullest advantage of the the service provided by the wonderful CPAN-Testers team.
On a related note, many CPAN modules are also repackaged in RPM, .deb and related formats. These files are easier for Joe Public to ins
Re:I say make it a dependency (Score:2)
Well, I take for granted the fact that all CPAN testers have at least all the Test::* modules installed.
Re:I say make it a dependency (Score:2)
Yes, but surely that's largely as a result of those modules being listed as prerequisites in the distributions being tested.