Changeset 448 for wiki-toolkit/trunk/lib/Wiki/Toolkit/TestLib.pm
- Timestamp:
- 07/01/08 17:11:41 (4 years ago)
- Files:
-
- 1 modified
-
wiki-toolkit/trunk/lib/Wiki/Toolkit/TestLib.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wiki-toolkit/trunk/lib/Wiki/Toolkit/TestLib.pm
r440 r448 45 45 my %datastore_info; 46 46 47 my %dsn_prefix = ( MySQL => "dbi:mysql:",48 Pg => "dbi:Pg:dbname=",49 SQLite => "dbi:SQLite:dbname=");50 51 47 foreach my $dbtype (qw( MySQL Pg SQLite )) { 52 48 if ( $configured{$dbtype}{dbname} ) { … … 54 50 my $store_class = "Wiki::Toolkit::Store::$dbtype"; 55 51 my $setup_class = "Wiki::Toolkit::Setup::$dbtype"; 56 my $dsn = $dsn_prefix{$dbtype}.$config{dbname}; 52 eval "require $store_class"; 53 if ( $@ ) { 54 warn "Couldn't require $store_class: $@\n"; 55 warn "Will skip $dbtype tests.\n"; 56 next; 57 } 58 my $dsn = $store_class->_dsn( @config{ qw( dbname dbhost dbport ) } ); 57 59 my $err; 58 if ( $err = _test_dsn( $dsn, $config{dbuser}, $config{dbpass}, $config{dbhost})) {60 if ( $err = _test_dsn( $dsn, $config{dbuser}, $config{dbpass} ) ) { 59 61 warn "connecting to test $dbtype database failed: $err\n"; 60 62 warn "will skip $dbtype tests\n"; … … 291 293 292 294 sub _test_dsn { 293 my ( $dsn, $dbuser, $dbpass, $dbhost ) = @_; 294 $dsn .= ";host=$dbhost" if $dbhost; 295 my ( $dsn, $dbuser, $dbpass ) = @_; 295 296 my $dbh = eval { 296 297 DBI->connect($dsn, $dbuser, $dbpass, {RaiseError => 1});
