# from Johan Vromans
# on Wednesday 27 February 2008 05:29:
>What would be a good means to arm the test scripts against this?
>
>This is what I currently use:
>
> $ntests = 37;
> SKIP: {
> eval { require DBD::Pg };
> skip("DBI PostgreSQL driver (DBD::Pg) not installed", $ntests)
> if $@;
>
> # Check minimal Pg interface version.
> my $minpg = 1.31;
> ok($DBD::Pg::VERSION >= $minpg,
> "DBD::PG version = $DBD::Pg::VERSION, should be at east
> $minpg"); $ntests--;
>
> SKIP: {
> skip("Database tests skipped on request", $ntests)
> if $ENV{EB_SKIPDBTESTS};
Wouldn't it be nifty to have something like a plugins/registry system
for determining what is available and whether we're allowed to use it?
use Test::Abilities;
...
my $can = Test::Abilities->want(create_db => 'DBD::Pg' => '>=1.31');
skip($can->message, $ntests) unless($can);
Then you build_requires 'Test::Abilities' and maybe recommends
'Test::Abilities::DBD::Pg'. Presumably that would prompt during setup
about permissions and/or control/dispatch them at runtime via user,
environment, and/or config data.
--Eric
--
"If you dig it, it's yours."
--An old village poet (via Al Pacino)
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------