NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Been There, Done That (Score:5, Insightful)
Actually, lots of CPAN modules do this already. All of the DBDs, for example, rely on the presence of environment variables in order to fully test their abilities to connect to databases. Similarly, HTML::Mason requires an environment variable for testing its ApacheHandler (since you can install and use Mason without mod_perl, if you like). And my App::Info module takes this approach so as to avoid testing values that may be different on a user's box than they would be on my own box.
That said, I agree that it should probably be trumpeted more loudly and the word got out to more people. OTOH, sometimes long tests are necessary, and having people run them when they install CPAN modules is the best way to smoke out issues with one's modules. If you don't want to wait, don't
make test.--David
.Reply to This
Similar (Score:5, Interesting)
For some of our longer running tests at work, I check for an environment variable named "FAST_TESTS" and skip long running tests using that. The start of my test_all program looks like this (and takes a -f as an argument for fast tests)
#!/usr/bin/perl -wuse strict;
use Test::Harness;
use Getopt::Long;
use Pod::Usage;
GetOptions(
'help|?' => sub { pod2usage(-verbose => 2); exit },
'verbose!' => \$Test::Harness::verbose,
'quiet' => sub { $Test::Harness::verbose = 0 },
'fast' => \$ENV{FAST_TESTS},
'include=s' => \my @include,
'exclude=s' => \my @exclude
);
Reply to This