From: Peter Rabbitson Date: Sun, 10 Jan 2016 14:26:40 +0000 (+0100) Subject: (optdeps) One last pass through tests, streamline skip messages X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=3cff955a7163e263490edecd0a1922aa5ee6c6db (optdeps) One last pass through tests, streamline skip messages --- diff --git a/t/73oracle.t b/t/73oracle.t index efbb996..7d6c790 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -473,7 +473,7 @@ sub _run_tests { # http://download.oracle.com/docs/cd/A87860_01/doc/server.817/a76961/ch294.htm#993 # Oracle Database Reference 10g Release 2 (10.2) # http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2107.htm#sthref1297 - todo_skip "On Oracle8i all_triggers view is empty, i don't yet know why...", 1 + todo_skip "FIXME: On Oracle8i all_triggers view is empty, i don't yet know why...", 1 if $schema->storage->_server_info->{normalized_dbms_version} < 9; my $schema2 = $schema->connect($dsn2, $user2, $pass2, $opt); diff --git a/t/746db2_400.t b/t/746db2_400.t index c06d4e4..1ce3b99 100644 --- a/t/746db2_400.t +++ b/t/746db2_400.t @@ -5,7 +5,6 @@ use strict; use warnings; use Test::More; -use DBIx::Class::Optional::Dependencies (); use DBICTest; diff --git a/t/747mssql_ado.t b/t/747mssql_ado.t index 6fdb8cc..d40cd17 100644 --- a/t/747mssql_ado.t +++ b/t/747mssql_ado.t @@ -7,7 +7,6 @@ use warnings; use Test::More; use Test::Exception; use Try::Tiny; -use DBIx::Class::Optional::Dependencies (); use DBICTest; diff --git a/t/750firebird.t b/t/750firebird.t index b0a2749..fac50d5 100644 --- a/t/750firebird.t +++ b/t/750firebird.t @@ -28,8 +28,6 @@ plan skip_all => join (' ', 'and "nonpkid_seq" and the trigger "artist_bi".', ) unless grep { $ENV{"${_}_DSN"} } keys %$env2optdep; -# tests stolen from 749sybase_asa.t - # Example DSNs: # dbi:Firebird:db=/var/lib/firebird/2.5/data/hlaghdb.fdb # dbi:InterBase:db=/var/lib/firebird/2.5/data/hlaghdb.fdb @@ -41,11 +39,9 @@ my $schema; for my $prefix (shuffle keys %$env2optdep) { SKIP: { - skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1) - unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix}); + DBIx::Class::Optional::Dependencies->skip_without( $env2optdep->{$prefix} ); my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/; - note "Testing with ${prefix}_DSN"; $schema = DBICTest::Schema->connect($dsn, $user, $pass, { diff --git a/t/84serialize.t b/t/84serialize.t index 0cacfc1..bbb5f4e 100644 --- a/t/84serialize.t +++ b/t/84serialize.t @@ -60,8 +60,9 @@ my %stores = ( ); -if ($ENV{DBICTEST_MEMCACHED}) { - if (DBIx::Class::Optional::Dependencies->req_ok_for ('test_memcached')) { +SKIP: { + DBIx::Class::Optional::Dependencies->skip_without('test_memcached'); + my $memcached = Cache::Memcached->new( { servers => [ $ENV{DBICTEST_MEMCACHED} ] } ); @@ -74,21 +75,8 @@ if ($ENV{DBICTEST_MEMCACHED}) { local $DBIx::Class::ResultSourceHandle::thaw_schema = $schema; return $memcached->get($key); }; - } - else { - SKIP: { - skip 'Memcached tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_memcached'), 1; - } - } -} -else { - SKIP: { - skip 'Set $ENV{DBICTEST_MEMCACHED} to run the memcached serialization tests', 1; - } } - - for my $name (keys %stores) { my $store = $stores{$name}; diff --git a/t/99dbic_sqlt_parser.t b/t/99dbic_sqlt_parser.t index 5551833..51e2521 100644 --- a/t/99dbic_sqlt_parser.t +++ b/t/99dbic_sqlt_parser.t @@ -11,7 +11,6 @@ use Test::Warn; use Test::Exception; use Scalar::Util (); - use DBICTest; use DBIx::Class::_Util 'sigwarn_silencer'; diff --git a/t/icdt/engine_specific/firebird.t b/t/icdt/engine_specific/firebird.t index 493b41f..5ce1d8f 100644 --- a/t/icdt/engine_specific/firebird.t +++ b/t/icdt/engine_specific/firebird.t @@ -28,14 +28,11 @@ my $schema; for my $prefix (keys %$env2optdep) { SKIP: { - my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/; - - next unless $dsn; + DBIx::Class::Optional::Dependencies->skip_without( $env2optdep->{$prefix} ); note "Testing with ${prefix}_DSN"; - skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1) - unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix}); + my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/; $schema = DBICTest::Schema->connect($dsn, $user, $pass, { quote_char => '"', diff --git a/t/resultset/rowparser_internals.t b/t/resultset/rowparser_internals.t index 2511684..235e5d4 100644 --- a/t/resultset/rowparser_internals.t +++ b/t/resultset/rowparser_internals.t @@ -890,7 +890,7 @@ done_testing; my $deparser; sub is_same_src { SKIP: { - skip "Skipping comparison of unicode-posioned source", 1 + skip "Skipping comparison of unicode-poisoned source", 1 if DBIx::Class::_ENV_::STRESSTEST_UTF8_UPGRADE_GENERATED_COLLAPSER_SOURCE; $deparser ||= B::Deparse->new; diff --git a/t/storage/base.t b/t/storage/base.t index e40745a..b4fd789 100644 --- a/t/storage/base.t +++ b/t/storage/base.t @@ -181,7 +181,8 @@ for my $type (keys %$invocations) { # make sure connection-less storages do not throw on _determine_driver # but work with ENV at the same time SKIP: for my $env_dsn (undef, (DBICTest->_database)[0] ) { - skip 'Subtest relies on being connected to SQLite', 1 + + skip 'This set of tests relies on being connected to SQLite', 1 if $env_dsn and $env_dsn !~ /\:SQLite\:/; local $ENV{DBI_DSN} = $env_dsn || ''; diff --git a/t/storage/global_destruction.t b/t/storage/global_destruction.t index 674c116..5b7fc85 100644 --- a/t/storage/global_destruction.t +++ b/t/storage/global_destruction.t @@ -16,24 +16,14 @@ use DBICTest; for my $type (qw/PG MYSQL SQLite/) { SKIP: { + + DBIx::Class::Optional::Dependencies->skip_without( 'test_rdbms_' . lc $type ); + my @dsn = $type eq 'SQLite' - ? DBICTest->_database(sqlite_use_file => 1) - : do { - skip "Skipping $type tests without DBICTEST_${type}_DSN", 1 - unless $ENV{"DBICTEST_${type}_DSN"}; - @ENV{map { "DBICTEST_${type}_${_}" } qw/DSN USER PASS/} - } + ? ( DBICTest->_database(sqlite_use_file => 1) ) + : ( @ENV{map { "DBICTEST_${type}_${_}" } qw/DSN USER PASS/} ) ; - if ($type eq 'PG') { - skip "skipping Pg tests without dependencies installed", 1 - unless DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_pg'); - } - elsif ($type eq 'MYSQL') { - skip "skipping MySQL tests without dependencies installed", 1 - unless DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_mysql'); - } - my $schema = DBICTest::Schema->connect (@dsn); # emulate a singleton-factory, just cache the object *somewhere in a different package* diff --git a/t/storage/quote_names.t b/t/storage/quote_names.t index 08fcd00..ff82d9f 100644 --- a/t/storage/quote_names.t +++ b/t/storage/quote_names.t @@ -52,8 +52,11 @@ my %expected = ( ); for my $class (keys %expected) { SKIP: { - eval "require ${class}" - or skip "Skipping test of quotes for $class due to missing dependencies", 1; + + eval "require ${class}" or do { + note "Failed load of $class:\n\n$@\n\n"; + skip "Skipping test of quotes for $class due to missing compile-time dependencies", 1; + }; my $mapping = $expected{$class}; my ($quote_char, $name_sep) = @$mapping{qw/quote_char name_sep/}; diff --git a/t/storage/savepoints.t b/t/storage/savepoints.t index f99c9d5..624ee9c 100644 --- a/t/storage/savepoints.t +++ b/t/storage/savepoints.t @@ -37,13 +37,10 @@ for ('', keys %$env2optdep) { SKIP: { my $prefix; if ($prefix = $_) { - my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/; - skip ("Skipping tests with $prefix: set \$ENV{${prefix}_DSN} _USER and _PASS", 1) - unless $dsn; + DBIx::Class::Optional::Dependencies->skip_without($env2optdep->{$prefix}); - skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1) - unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix}); + my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/; $schema = DBICTest::Schema->connect ($dsn,$user,$pass,{ auto_savepoint => 1 }); @@ -231,7 +228,7 @@ for ('', keys %$env2optdep) { SKIP: { is_deeply( $schema->storage->savepoints, [], 'All savepoints forgotten' ); SKIP: { - skip "Reading inexplicably fails on very old replicated DBD::SQLite<1.33", 1 if ( + skip "FIXME: Reading inexplicably fails on very old replicated DBD::SQLite<1.33", 1 if ( $ENV{DBICTEST_VIA_REPLICATED} and $prefix eq 'SQLite Internal DB' diff --git a/t/storage/txn.t b/t/storage/txn.t index 382727c..9af0040 100644 --- a/t/storage/txn.t +++ b/t/storage/txn.t @@ -211,7 +211,7 @@ sub _test_forking_action { SKIP: for my $count (1 .. 5) { - skip 'Weird DBI General Protection Faults, skip forking tests (RT#63104)', 5 + skip 'FIXME: Weird DBI General Protection Faults, skip forking tests (RT#63104)', 5 if $^O eq 'MSWin32'; my $pid = fork();