timeout lock-prone.
* Misc
+ - Skip tests in a way more intelligent and speedy manner when optional
+ dependencies are missing
- Make the Optional::Dependencies error messages cpanm-friendly
- Incompatibly change values (not keys) of the hash returned by
Optional::Dependencies::req_group_list (no known users in the wild)
package DBIx::Class::Optional::Dependencies;
-use warnings;
-use strict;
-
-use Carp;
+### This may look crazy, but it in fact tangibly ( by 50(!)% ) shortens
+# the skip-test time when everything requested is unavailable
+use if $ENV{RELEASE_TESTING} => 'warnings';
+use if $ENV{RELEASE_TESTING} => 'strict';
+
+sub croak {
+ require Carp;
+ Carp::croak(@_);
+};
+###
# NO EXTERNAL NON-5.8.1 CORE DEPENDENCIES EVER (e.g. C::A::G)
# This module is to be loaded by Makefile.PM on a pristine system
req => {
'Test::Pod' => '1.42',
},
+ release_testing_mandatory => 1,
},
test_podcoverage => {
'Test::Pod::Coverage' => '1.08',
'Pod::Coverage' => '0.20',
},
+ release_testing_mandatory => 1,
},
test_whitespace => {
'Test::EOL' => '1.0',
'Test::NoTabs' => '0.9',
},
+ release_testing_mandatory => 1,
},
test_strictures => {
req => {
'Test::Strict' => '0.20',
},
+ release_testing_mandatory => 1,
},
test_prettydebug => {
print "\n";
exit 0;
}
+ elsif ($action eq '-skip_all_without') {
+
+ # sanity check - make sure ->current_test is 0 and no plan has been declared
+ do {
+ local $@;
+ defined eval {
+ Test::Builder->new->current_test
+ or
+ Test::Builder->new->has_plan
+ };
+ } and croak("Unable to invoke -skip_all_without after testing has started");
+
+ if ( my $missing = $class->req_missing_for(\@_) ) {
+
+ die ("\nMandatory requirements not satisfied during release-testing: $missing\n\n")
+ if $ENV{RELEASE_TESTING} and $class->_groups_to_reqs(\@_)->{release_testing_mandatory};
+
+ print "1..0 # SKIP requirements not satisfied: $missing\n";
+ exit 0;
+ }
+ }
elsif ($action =~ /^-/) {
croak "Unknown import-time action '$action'";
}
$ret->{effective_modreqs_differ} ||= !!$some_envs_missing;
$ret->{modreqs_fully_documented} &&= !!$dbic_reqs->{$group}{pod};
+
+ $ret->{release_testing_mandatory} ||= !!$dbic_reqs->{$group}{release_testing_mandatory};
}
return $ret;
Even though this module is not an L<Exporter>, it recognizes several C<actions>
supplied to its C<import> method.
+=head2 -skip_all_without
+
+=over
+
+=item Arguments: @group_names
+
+=back
+
+A convenience wrapper for use during testing:
+EOC
+
+ push @chunks, " use $class -skip_all_without => qw(admin test_rdbms_mysql);";
+
+ push @chunks, 'Roughly equivalent to the following code:';
+
+ push @chunks, sprintf <<'EOS', ($class) x 2;
+
+ BEGIN {
+ require %s;
+ if ( my $missing = %s->req_missing_for(\@group_names_) ) {
+ print "1..0 # SKIP requirements not satisfied: $missing\n";
+ exit 0;
+ }
+ }
+EOS
+
+ push @chunks, <<'EOC';
+
+It also takes into account the C<RELEASE_TESTING> environment variable and
+behaves like L</-die_without> for any requirement groups marked as
+C<release_testing_mandatory>.
+
=head2 -die_without
=over
-#!/usr/bin/perl
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'deploy';
use strict;
use warnings;
use ViewDeps;
use ViewDepsBad;
-BEGIN {
- require DBIx::Class;
- plan skip_all => 'Test needs ' .
- DBIx::Class::Optional::Dependencies->req_missing_for('deploy')
- unless DBIx::Class::Optional::Dependencies->req_ok_for('deploy');
-}
-
-use_ok('DBIx::Class::ResultSource::View');
-
#################### SANITY
my $view = DBIx::Class::ResultSource::View->new;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_pg';
+
use strict;
use warnings;
use Test::More;
use lib qw(t/lib);
use DBICTest;
-use DBIx::Class::Optional::Dependencies ();
my $main_pid = $$;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
-
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
-
-plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
- . ' (note: creates and drops a table named artist!)' unless ($dsn && $user);
-
# README: If you set the env var to a number greater than 10,
# we will use that many children
my $num_children = $ENV{DBICTEST_FORK_STRESS} || 1;
$num_children = 10;
}
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { AutoCommit => 1 });
my $parent_rs;
}
use threads;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_pg';
+
use strict;
use warnings;
plan skip_all => 'DBIC does not actively support threads before perl 5.8.5'
if $] < '5.008005';
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
-
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
-plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
- . ' (note: creates and drops a table named artist!)' unless ($dsn && $user);
-
# README: If you set the env var to a number greater than 10,
# we will use that many children
my $num_children = $ENV{DBICTEST_THREAD_STRESS} || 1;
$num_children = 10;
}
-use_ok('DBICTest::Schema');
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { AutoCommit => 1, RaiseError => 1, PrintError => 0 });
}
use threads;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_pg';
+
use strict;
use warnings;
plan skip_all => 'DBIC does not actively support threads before perl 5.8.5'
if $] < '5.008005';
-use DBIx::Class::Optional::Dependencies ();
use Scalar::Util 'weaken';
use lib qw(t/lib);
use DBICTest;
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
-plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
- . ' (note: creates and drops a table named artist!)' unless ($dsn && $user);
-
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
-
my $num_children = $ENV{DBICTEST_THREAD_STRESS} || 1;
if($num_children !~ /^[0-9]+$/ || $num_children < 10) {
$num_children = 10;
}
-use_ok('DBICTest::Schema');
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { AutoCommit => 1, RaiseError => 1, PrintError => 0 });
constant
overload
+ if
base
Devel::GlobalDestruction
mro
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_mysql';
+
use strict;
use warnings;
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mysql')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mysql');
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
-plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
- unless ($dsn && $user);
-
my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { quote_names => 1 });
my $dbh = $schema->storage->dbh;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_pg';
+
use strict;
use warnings;
use SQL::Abstract 'is_literal_value';
use DBIx::Class::_Util 'is_exception';
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_pg')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_pg');
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
-plan skip_all => <<'EOM' unless $dsn && $user;
-Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test
-( NOTE: This test drops and creates tables called 'artist', 'cd',
-'timestamp_primary_key_test', 'track', 'casecheck', 'array_test' and
-'sequence_test' as well as following sequences: 'pkid1_seq', 'pkid2_seq' and
-'nonpkid_seq'. as well as following schemas: 'dbic_t_schema',
-'dbic_t_schema_2', 'dbic_t_schema_3', 'dbic_t_schema_4', and 'dbic_t_schema_5')
-EOM
-
### load any test classes that are defined further down in the file via BEGIN blocks
-
our @test_classes; #< array that will be pushed into by test classes defined in this file
DBICTest::Schema->load_classes( map {s/.+:://;$_} @test_classes ) if @test_classes;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_pg';
+
use strict;
use warnings;
use Test::More;
-use DBIx::Class::Optional::Dependencies ();
use Try::Tiny;
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_pg')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_pg');
-
my ($dsn, $dbuser, $dbpass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
-plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
- unless ($dsn && $dbuser);
-
my $schema = DBICTest::Schema->connect($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
if ($schema->storage->_server_info->{normalized_dbms_version} >= 9.0) {
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_oracle';
+
use strict;
use warnings;
use Test::More;
use Sub::Name;
use Try::Tiny;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
+$ENV{NLS_SORT} = "BINARY";
+$ENV{NLS_COMP} = "BINARY";
+$ENV{NLS_LANG} = "AMERICAN";
+
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
# optional:
my ($dsn2, $user2, $pass2) = @ENV{map { "DBICTEST_ORA_EXTRAUSER_${_}" } qw/DSN USER PASS/};
-plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test.'
- unless ($dsn && $user && $pass);
-
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle');
-
-$ENV{NLS_SORT} = "BINARY";
-$ENV{NLS_COMP} = "BINARY";
-$ENV{NLS_LANG} = "AMERICAN";
-
{
package # hide from PAUSE
DBICTest::Schema::ArtistFQN;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_oracle';
+
use strict;
use warnings;
use Test::More;
use Sub::Name;
use Try::Tiny;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
-
-plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test.'
- unless ($dsn && $user && $pass);
-
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle');
-
$ENV{NLS_SORT} = "BINARY";
$ENV{NLS_COMP} = "BINARY";
$ENV{NLS_LANG} = "AMERICAN";
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
+
my $v = do {
my $si = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info;
$si->{normalized_dbms_version}
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_oracle';
+
use strict;
use warnings;
# dealing with HQs. So just punt on the entire shuffle thing.
BEGIN { $ENV{DBIC_SHUFFLE_UNORDERED_RESULTSETS} = 0 }
-
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
-$ENV{NLS_SORT} = "BINARY";
-$ENV{NLS_COMP} = "BINARY";
-$ENV{NLS_LANG} = "AMERICAN";
-
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
-
-plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test.'
- unless ($dsn && $user && $pass);
-
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_oracle')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_oracle');
-
use DBICTest::Schema::Artist;
BEGIN {
DBICTest::Schema::Artist->add_column('parentid');
use DBICTest;
use DBICTest::Schema;
+$ENV{NLS_SORT} = "BINARY";
+$ENV{NLS_COMP} = "BINARY";
+$ENV{NLS_LANG} = "AMERICAN";
+
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
note "Oracle Version: " . $schema->storage->_server_info->{dbms_version};
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_db2';
+
use strict;
use warnings;
use Test::More;
use Test::Exception;
use Try::Tiny;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_db2')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_db2');
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_${_}" } qw/DSN USER PASS/};
-
-#warn "$dsn $user $pass";
-
-plan skip_all => 'Set $ENV{DBICTEST_DB2_DSN}, _USER and _PASS to run this test'
- unless ($dsn && $user);
-
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
my $name_sep = $schema->storage->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR');
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_db2_400';
+
use strict;
use warnings;
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_db2_400')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_db2_400');
-
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_400_${_}" } qw/DSN USER PASS/};
-
-#warn "$dsn $user $pass";
-
# Probably best to pass the DBQ option in the DSN to specify a specific
# libray. Something like:
# DBICTEST_DB2_400_DSN='dbi:ODBC:dsn=MyAS400;DBQ=MYLIB'
-plan skip_all => 'Set $ENV{DBICTEST_DB2_400_DSN}, _USER and _PASS to run this test'
- unless ($dsn && $user);
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_400_${_}" } qw/DSN USER PASS/};
plan tests => 6;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_mssql_odbc';
+
use strict;
use warnings;
use Test::Exception;
use Try::Tiny;
-use DBIx::Class::Optional::Dependencies ();
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mssql_odbc')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_odbc');
-
use lib qw(t/lib);
use DBICTest;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ODBC_${_}" } qw/DSN USER PASS/};
-plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this test'
- unless ($dsn && $user);
-
{
my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version};
ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') );
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_ase';
+
use strict;
use warnings;
no warnings 'uninitialized';
use Test::More;
use Test::Exception;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_${_}" } qw/DSN USER PASS/};
-if (not ($dsn && $user)) {
- plan skip_all => join ' ',
- 'Set $ENV{DBICTEST_SYBASE_DSN}, _USER and _PASS to run this test.',
- 'Warning: This test drops and creates the tables:',
- "'artist', 'money_test' and 'bindtype_test'",
- ;
-};
-
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_ase')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_ase');
-
my @storage_types = (
'DBI::Sybase::ASE',
'DBI::Sybase::ASE::NoBindVars',
);
-eval "require DBIx::Class::Storage::$_;" for @storage_types;
+eval "require DBIx::Class::Storage::$_;" or die $@
+ for @storage_types;
my $schema;
my $storage_idx = -1;
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_${_}" } qw/DSN USER PASS/};
+
sub get_schema {
DBICTest::Schema->connect($dsn, $user, $pass, {
on_connect_call => [
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_mssql_ado';
+
use strict;
use warnings;
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mssql_ado')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_ado');
-
# Example DSN (from frew):
# dbi:ADO:PROVIDER=sqlncli10;SERVER=tcp:172.24.2.10;MARS Connection=True;Initial Catalog=CIS;UID=cis_web;PWD=...;DataTypeCompatibility=80;
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ADO_${_}" } qw/DSN USER PASS/};
-plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ADO_DSN}, _USER and _PASS to run this test'
- unless ($dsn && $user);
-
DBICTest::Schema->load_classes(qw/VaryingMAX ArtistGUID/);
my %binstr = ( 'small' => join('', map { chr($_) } ( 1 .. 127 )) );
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_informix';
+
use strict;
use warnings;
use Test::More;
use Test::Exception;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_informix')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_informix');
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_INFORMIX_${_}" } qw/DSN USER PASS/};
-#warn "$dsn $user $pass";
-
-plan skip_all => 'Set $ENV{DBICTEST_INFORMIX_DSN}, _USER and _PASS to run this test'
- unless $dsn;
-
my $schema = DBICTest::Schema->connect($dsn, $user, $pass, {
auto_savepoint => 1
});
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_mssql_sybase';
+
use strict;
use warnings;
use Test::More;
use Test::Exception;
use Scalar::Util 'weaken';
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/};
-
-plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test'
- unless ($dsn);
-
-
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mssql_sybase')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_sybase');
-
{
my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version};
ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') );
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'deploy';
+
use strict;
use warnings;
use Test::More;
use Test::Warn;
-use lib qw(t/lib);
-use DBICTest;
-
use Scalar::Util 'blessed';
-BEGIN {
- require DBIx::Class;
- plan skip_all =>
- 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('deploy')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
-}
+use lib qw(t/lib);
+use DBICTest;
my $custom_deployment_statements_called = 0;
return $self->next::method(@_);
}
-
# Check deployment statements ctx sensitivity
{
my $schema = DBICTest->init_schema (no_deploy => 1, quote_names => 1);
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw(deploy test_rdbms_mysql);
+
use strict;
use warnings;
use DBICTest;
use DBIx::Class::_Util 'sigwarn_silencer';
-my ($dsn, $user, $pass);
-
-BEGIN {
- ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
-
- plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
- unless ($dsn);
-
- require DBIx::Class;
- plan skip_all =>
- 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('deploy')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy');
-
- plan skip_all =>
- 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mysql')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mysql');
-}
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
# this is just to grab a lock
{
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt';
+
use strict;
use warnings;
use lib qw(t/lib);
use DBICTest;
-BEGIN {
- require DBIx::Class;
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
-}
-
my $schema = DBICTest->init_schema();
my $artist_rs = $schema->resultset('Artist');
my $cd_rs = $schema->resultset('CD');
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'deploy';
+
use strict;
use warnings;
use DBICTest;
use DBIx::Class::_Util 'sigwarn_silencer';
-BEGIN {
- require DBIx::Class;
- plan skip_all =>
- 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('deploy')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
-}
-
# Test for SQLT-related leaks
{
my $s = DBICTest::Schema->clone;
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( admin deploy );
+
use strict;
use warnings;
use DBICTest;
use DBIx::Class::_Util 'sigwarn_silencer';
-BEGIN {
- require DBIx::Class;
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin')
- unless DBIx::Class::Optional::Dependencies->req_ok_for('admin');
-
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('deploy')
- unless DBIx::Class::Optional::Dependencies->req_ok_for('deploy');
-}
-
-use_ok 'DBIx::Class::Admin';
+use DBIx::Class::Admin;
# lock early
DBICTest->init_schema(no_deploy => 1, no_populate => 1);
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'admin';
+
use strict;
use warnings;
use lib 't/lib';
use DBICTest;
-BEGIN {
- require DBIx::Class;
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin')
- unless DBIx::Class::Optional::Dependencies->req_ok_for('admin');
-}
-
-use_ok 'DBIx::Class::Admin';
-
+use DBIx::Class::Admin;
{ # test data maniplulation functions
-# vim: filetype=perl
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_admin_script';
+
use strict;
use warnings;
+BEGIN {
+ # just in case the user env has stuff in it
+ delete $ENV{JSON_ANY_ORDER};
+}
+
use Test::More;
use Config;
use File::Spec;
use lib qw(t/lib);
use DBICTest;
-BEGIN {
- require DBIx::Class;
- plan skip_all => 'Test needs ' .
- DBIx::Class::Optional::Dependencies->req_missing_for('test_admin_script')
- unless DBIx::Class::Optional::Dependencies->req_ok_for('test_admin_script');
-
- # just in case the user env has stuff in it
- delete $ENV{JSON_ANY_ORDER};
-}
-
$ENV{PATH} = '';
$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
-require JSON::Any;
my @json_backends = qw(DWIW PP JSON CPANEL XS);
# test the script is setting @INC properly
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt_sqlite';
+
use strict;
use warnings;
# of the "" operator.
use Test::More;
-use DBIx::Class::Optional::Dependencies;
-
-BEGIN {
- plan skip_all => "Test needs ".DBIx::Class::Optional::Dependencies->req_missing_for('test_dt_sqlite')
- unless DBIx::Class::Optional::Dependencies->req_ok_for('test_dt_sqlite');
-}
use lib 't/cdbi/testlib';
use ImplicitInflate;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt';
+
use strict;
use warnings;
my $schema = DBICTest->init_schema();
-plan skip_all => 'Inflation tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
-
$schema->class('CD') ->inflate_column( 'year',
{ inflate => sub { DateTime->new( year => shift ) },
deflate => sub { shift->year } }
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt_sqlite';
+
use strict;
use warnings;
my $schema = DBICTest->init_schema();
-plan skip_all => 'DT inflation tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_sqlite')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_sqlite');
-
# inflation test
my $event = $schema->resultset("Event")->find(1);
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt_sqlite';
+
use strict;
use warnings;
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_sqlite')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_sqlite');
-
my $schema = DBICTest->init_schema(
no_deploy => 1, # Deploying would cause an early rebless
);
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt';
+
use strict;
use warnings;
use Test::More;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
use Scope::Guard ();
"WARNING: This test drops and creates a table called 'event'",
) unless grep { $ENV{"${_}_DSN"} } keys %$env2optdep;
-plan skip_all => ( 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('test_dt') )
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
-
my $schema;
for my $prefix (keys %$env2optdep) { SKIP: {
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( test_dt test_rdbms_informix );
+
use strict;
use warnings;
use Test::More;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
use Scope::Guard ();
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
-. ' and ' .
-DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_informix')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt')
- && DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_informix');
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_INFORMIX_${_}" } qw/DSN USER PASS/};
-
-if (not $dsn) {
- plan skip_all => <<'EOF';
-Set $ENV{DBICTEST_INFORMIX_DSN} _USER and _PASS to run this test'.
-Warning: This test drops and creates a table called 'event'";
-EOF
-}
-
my $schema;
{
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt_mysql';
+
use strict;
use warnings;
use Test::More;
use Test::Exception;
use Test::Warn;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
use DBICTest::Schema;
use DBIx::Class::_Util 'sigwarn_silencer';
-plan skip_all => 'Inflation tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_mysql')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_mysql');
-
{
DBICTest::Schema->load_classes('EventTZ');
local $SIG{__WARN__} = sigwarn_silencer( qr/extra \=\> .+? has been deprecated/ );
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_oracle';
+
use strict;
use warnings;
use Test::More;
use Test::Exception;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle');
-
-my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
-
-if (not ($dsn && $user && $pass)) {
- plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test. ' .
- 'Warning: This test drops and creates a table called \'event\'';
-}
-
# DateTime::Format::Oracle needs this set
$ENV{NLS_DATE_FORMAT} = 'DD-MON-YY';
$ENV{NLS_TIMESTAMP_FORMAT} = 'YYYY-MM-DD HH24:MI:SSXFF';
$ENV{NLS_SORT} = "BINARY";
$ENV{NLS_COMP} = "BINARY";
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
# older oracles do not support a TIMESTAMP datatype
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt_pg';
+
use strict;
use warnings;
use Test::More;
use Test::Warn;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_pg')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_pg');
-
DBICTest::Schema->load_classes('EventTZPg');
my $schema = DBICTest->init_schema();
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw(test_dt test_rdbms_ase);
+
use strict;
use warnings;
use Test::Exception;
use Scope::Guard ();
use Try::Tiny;
-use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt')
-. ' and ' .
-DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_ase')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt')
- && DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_ase');
-
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_${_}" } qw/DSN USER PASS/};
-if (not ($dsn && $user)) {
- plan skip_all =>
- 'Set $ENV{DBICTEST_SYBASE_DSN}, _USER and _PASS to run this test' .
- "\nWarning: This test drops and creates a table called 'track' and " .
- "'event_small_dt'";
-}
-
DBICTest::Schema->load_classes('EventSmallDT');
my @storage_types = (
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'id_shortener';
+
use strict;
use warnings;
use Test::More;
-use lib qw(t/lib);
-
-use DBIx::Class::Optional::Dependencies;
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener');
+use lib qw(t/lib);
use DBICTest::Schema::Artist;
BEGIN {
DBICTest::Schema::Artist->add_column('parentid');
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'id_shortener';
+
use strict;
use warnings;
-use Test::More;
-
-BEGIN {
- require DBIx::Class::Optional::Dependencies;
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener');
-}
+use Test::More;
use Test::Exception;
use Data::Dumper::Concise;
use lib qw(t/lib);
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'id_shortener';
+
use strict;
use warnings;
use Test::More;
-BEGIN {
- require DBIx::Class::Optional::Dependencies;
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener');
-}
-
use lib qw(t/lib);
use DBICTest ':DiffSQL';
use DBIx::Class::SQLMaker::OracleJoins;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_prettydebug';
+
use strict;
use warnings;
+
use lib qw(t/lib);
use DBICTest;
use Test::More;
-BEGIN {
- require DBIx::Class;
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_prettydebug')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_prettydebug');
-}
-
BEGIN { delete @ENV{qw(DBIC_TRACE_PROFILE)} }
{
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'deploy';
+
use strict;
use warnings;
use lib qw(t/lib);
use DBICTest;
-BEGIN {
- require DBIx::Class;
- plan skip_all =>
- 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('deploy')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
-}
-
local $ENV{DBI_DSN};
# this is how maint/gen_schema did it (connect() to force a storage
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_replicated';
+
use strict;
use warnings;
use Test::More;
-
+use DBIx::Class::_Util 'modver_gt_or_eq_and_lt';
use lib qw(t/lib);
use DBICTest;
BEGIN {
- require DBIx::Class;
- plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_replicated')
- unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_replicated');
-
- if (DBICTest::RunMode->is_smoker) {
- my $mver = Moose->VERSION;
- plan skip_all => "A trial version $mver of Moose detected known to break replication - skipping test known to fail"
- if ($mver >= 1.99 and $mver <= 1.9902);
- }
-
+ plan skip_all => "A trial version of Moose detected known to break replication - skipping test known to fail" if (
+ DBICTest::RunMode->is_smoker
+ and
+ modver_gt_or_eq_and_lt( 'Moose', '1.99', '1.9903' )
+ )
}
use Test::Moose;
-use strict;
-use warnings;
-no warnings qw/once/;
-
my ($inc_before, $inc_after);
BEGIN {
- require Carp; # Carp is not used in the test, but in OptDeps, load for proper %INC comparison
-
$inc_before = [ keys %INC ];
require DBIx::Class::Optional::Dependencies;
$inc_after = [ keys %INC ];
}
+use strict;
+use warnings;
+no warnings qw/once/;
+
use Test::More;
use Test::Exception;
# load before we break require()
use Scalar::Util();
use MRO::Compat();
+use Carp 'confess';
ok ( (! grep { $_ =~ m|DBIx/Class| } @$inc_before ), 'Nothing DBIC related was loaded before inc-test')
unless $ENV{PERL5OPT}; # a defined PERL5OPT may inject extra deps crashing this test
is_deeply (
[ sort @$inc_after],
- [ sort (@$inc_before, 'DBIx/Class/Optional/Dependencies.pm') ],
+ [ sort (@$inc_before, qw( DBIx/Class/Optional/Dependencies.pm if.pm )) ],
'Nothing loaded other than DBIx::Class::OptDeps',
-);
+) unless $ENV{RELEASE_TESTING};
# check the project-local groups for sanity
{
# make module loading impossible, regardless of actual libpath contents
- local @INC = (sub { Carp::confess('Optional Dep Test') } );
+ local @INC = (sub { confess('Optional Dep Test') } );
# basic test using the deploy target
for ('deploy', ['deploy']) {
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_pod';
+
use warnings;
use strict;
use lib qw(t/lib);
use DBICTest;
-require DBIx::Class;
-unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_pod') ) {
- my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_pod');
- $ENV{RELEASE_TESTING}
- ? die ("Failed to load release-testing module requirements: $missing")
- : plan skip_all => "Test needs: $missing"
-}
-
# this has already been required but leave it here for CPANTS static analysis
require Test::Pod;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_podcoverage';
+
use warnings;
use strict;
use DBICTest;
use namespace::clean;
-require DBIx::Class;
-unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_podcoverage') ) {
- my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_podcoverage');
- $ENV{RELEASE_TESTING}
- ? die ("Failed to load release-testing module requirements: $missing")
- : plan skip_all => "Test needs: $missing"
-}
-
# this has already been required but leave it here for CPANTS static analysis
require Test::Pod::Coverage;
mk_classaccessor
/]
},
+ 'DBIx::Class::Optional::Dependencies' => {
+ ignore => [qw/
+ croak
+ /]
+ },
'DBIx::Class::Carp' => {
ignore => [qw/
unimport
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_strictures';
+
use warnings;
use strict;
use Test::More;
+use File::Find;
use lib 't/lib';
use DBICTest;
-unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_strictures') ) {
- my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_strictures');
- $ENV{RELEASE_TESTING}
- ? die ("Failed to load release-testing module requirements: $missing")
- : plan skip_all => "Test needs: $missing"
-}
-
-use File::Find;
-
# The rationale is - if we can load all our optdeps
# that are related to lib/ - then we should be able to run
# perl -c checks (via syntax_ok), and all should just work
maint/Makefile.PL.inc/.+ # all the maint inc snippets are auto-strictured
|
t/lib/DBICTest/Util/OverrideRequire.pm # no stictures by design (load order sensitive)
+ |
+ lib/DBIx/Class/Optional/Dependencies.pm # no stictures by design (load spee sensitive)
)$}x;
my $f = $_;
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_whitespace';
+
use warnings;
use strict;
use lib 't/lib';
use DBICTest ':GlobalLock';
-require DBIx::Class;
-unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_whitespace') ) {
- my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_whitespace');
- $ENV{RELEASE_TESTING}
- ? die ("Failed to load release-testing module requirements: $missing")
- : plan skip_all => "Test needs: $missing"
-}
-
# FIXME - temporary workaround for RT#82032, RT#82033
# also add all scripts (no extension) and some extra extensions
# we want to check