From: Peter Rabbitson Date: Sun, 6 Sep 2009 15:39:03 +0000 (+0000) Subject: Test cleanup: X-Git-Tag: v0.08111~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dc4600b2b9be4ae9a91c8ab49bdbb7ce2c23d0f7;hp=014fd55671aaf0e2060e31cc2e547661346f3106;p=dbsrgits%2FDBIx-Class.git Test cleanup: Benchmark and Data::Dumper have been in core forever Make POD testing conditional as shown in http://use.perl.org/~Alias/journal/38822 Remove some dead cdbi test files Stop openly giving contributors an option to override the authorcheck --- diff --git a/Makefile.PL b/Makefile.PL index dab1348..adbd004 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -61,9 +61,15 @@ my %force_requires_if_author = ( %replication_requires, # 'Module::Install::Pod::Inherit' => '0.01', - 'Test::Pod::Coverage' => '1.04', 'SQL::Translator' => $sqlt_recommends, + # when changing also adjust version in t/02pod.t + 'Test::Pod' => '1.26', + + # when changing also adjust version in t/03podcoverage.t + 'Test::Pod::Coverage' => '1.08', + 'Pod::Coverage' => '0.20', + # CDBI-compat related 'DBIx::ContextualFetch' => '0', 'Class::DBI::Plugin::DeepAbstractSearch' => '0', diff --git a/script/dbicadmin b/script/dbicadmin index 2c92842..d6c8ecd 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -30,7 +30,7 @@ if ($t_libs) { } pod2usage(1) if ($help); -$ENV{DBIX_CLASS_STORAGE_DBI_DEBUG} = 1 if ($trace); +$ENV{DBIC_TRACE} = 1 if ($trace); die('No op specified') if(!$op); die('Invalid op') if ($op!~/^insert|update|delete|select$/s); diff --git a/t/02pod.t b/t/02pod.t index ddc2905..729aa09 100644 --- a/t/02pod.t +++ b/t/02pod.t @@ -1,6 +1,27 @@ +use warnings; +use strict; + use Test::More; +use lib qw(t/lib); +use DBICTest; + +my @MODULES = ( + 'Test::Pod 1.26', +); + +# Don't run tests for installs +unless ( DBICTest::AuthorCheck->is_author || $ENV{AUTOMATED_TESTING} || $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} -eval "use Test::Pod 1.14"; -plan skip_all => 'Test::Pod 1.14 required' if $@; +# Load the testing modules +foreach my $MODULE ( @MODULES ) { + eval "use $MODULE"; + if ( $@ ) { + $ENV{RELEASE_TESTING} + ? die( "Failed to load required release-testing module $MODULE" ) + : plan( skip_all => "$MODULE not available for testing" ); + } +} all_pod_files_ok(); diff --git a/t/03podcoverage.t b/t/03podcoverage.t index 70d51ea..b060014 100644 --- a/t/03podcoverage.t +++ b/t/03podcoverage.t @@ -1,14 +1,30 @@ +use warnings; +use strict; + use Test::More; use List::Util (); +use lib qw(t/lib); +use DBICTest; -eval "use Pod::Coverage 0.19"; -plan skip_all => 'Pod::Coverage 0.19 required' if $@; -eval "use Test::Pod::Coverage 1.04"; -plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@; +my @MODULES = ( + 'Test::Pod::Coverage 1.08', + 'Pod::Coverage 0.20', +); -plan skip_all => 'set TEST_POD to enable this test' - unless ($ENV{TEST_POD} || -e 'MANIFEST.SKIP'); +# Don't run tests for installs +unless ( DBICTest::AuthorCheck->is_author || $ENV{AUTOMATED_TESTING} || $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} +# Load the testing modules +foreach my $MODULE ( @MODULES ) { + eval "use $MODULE"; + if ( $@ ) { + $ENV{RELEASE_TESTING} + ? die( "Failed to load required release-testing module $MODULE" ) + : plan( skip_all => "$MODULE not available for testing" ); + } +} # Since this is about checking documentation, a little documentation # of what this is doing might be in order. diff --git a/t/26dumper.t b/t/26dumper.t index ddb4a00..e392df9 100644 --- a/t/26dumper.t +++ b/t/26dumper.t @@ -6,15 +6,6 @@ use Data::Dumper; $Data::Dumper::Sortkeys = 1; use lib qw(t/lib); - -BEGIN { - eval "use DBD::SQLite"; - plan $ENV{DATA_DUMPER_TEST} - ? ( tests => 2 ) - : ( skip_all => 'Set $ENV{DATA_DUMPER_TEST} to run this test' ); -} - - use_ok('DBICTest'); my $schema = DBICTest->init_schema(); @@ -36,4 +27,4 @@ $rs = $schema->resultset('CD')->search({ cmp_ok( $rs->count(), '==', 1, "Single record in after death with dumper"); -1; +done_testing; diff --git a/t/cdbi/testlib/Binary.pm b/t/cdbi/testlib/Binary.pm deleted file mode 100644 index 58d2bf4..0000000 --- a/t/cdbi/testlib/Binary.pm +++ /dev/null @@ -1,16 +0,0 @@ -package # hide from PAUSE - Binary; - -use strict; -use base 'PgBase'; - -__PACKAGE__->table(cdbibintest => 'cdbibintest'); -__PACKAGE__->sequence('binseq'); -__PACKAGE__->columns(All => qw(id bin)); - -# __PACKAGE__->data_type(bin => DBI::SQL_BINARY); - -sub schema { "id INTEGER, bin BYTEA" } - -1; - diff --git a/t/cdbi/testlib/PgBase.pm b/t/cdbi/testlib/PgBase.pm deleted file mode 100644 index 8c13493..0000000 --- a/t/cdbi/testlib/PgBase.pm +++ /dev/null @@ -1,23 +0,0 @@ -package # hide from PAUSE - PgBase; - -use strict; -use base 'DBIx::Class::CDBICompat'; - -my $db = $ENV{DBD_PG_DBNAME} || 'template1'; -my $user = $ENV{DBD_PG_USER} || 'postgres'; -my $pass = $ENV{DBD_PG_PASSWD} || ''; - -__PACKAGE__->connection("dbi:Pg:dbname=$db", $user, $pass, - { AutoCommit => 1 }); - -sub CONSTRUCT { - my $class = shift; - my ($table, $sequence) = ($class->table, $class->sequence || ""); - my $schema = $class->schema; - $class->db_Main->do("CREATE TEMPORARY SEQUENCE $sequence") if $sequence; - $class->db_Main->do("CREATE TEMPORARY TABLE $table ( $schema )"); -} - -1; - diff --git a/t/lib/DBICTest/AuthorCheck.pm b/t/lib/DBICTest/AuthorCheck.pm index 1e58b93..f793cf0 100644 --- a/t/lib/DBICTest/AuthorCheck.pm +++ b/t/lib/DBICTest/AuthorCheck.pm @@ -54,21 +54,17 @@ sub _check_author_makefile { We have a number of reasons to believe that this is a development checkout and that you, the user, did not run `perl Makefile.PL` before using this code. You absolutely _must_ perform this step, -as not doing so often results in a lot of wasted time for other -contributors trying to assit you with "it broke!" problems. +and ensure you have all required dependencies present. Not doing +so often results in a lot of wasted time for other contributors +trying to assit you with spurious "its broken!" problems. If you are seeing this message unexpectedly (i.e. you are in fact -attempting a regular installation be it through CPAN or manually, -set the variable DBICTEST_NO_MAKEFILE_VERIFICATION to a true value -so you can continue. Also _make_absolutely_sure_ to report this to -either the mailing list or to the irc channel as described in +attempting a regular installation be it through CPAN or manually), +please report the situation to either the mailing list or to the +irc channel as described in http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm#GETTING_HELP/SUPPORT -Failure to do this will make us believe that all these checks are -indeed foolproof and we will remove the ability to override this -entirely. - The DBIC team @@ -79,6 +75,19 @@ EOE } } +# Mimic $Module::Install::AUTHOR +sub is_author { + + my $root = _find_co_root() + or return undef; + + return ( + ( not -d $root->subdir ('inc') ) + or + ( -e $root->subdir ('inc')->file ($^O eq 'VMS' ? '_author' : '.author') ) + ); +} + # Try to determine the root of a checkout/untar if possible # or return undef sub _find_co_root { diff --git a/t/zzzzzzz_perl_perf_bug.t b/t/zzzzzzz_perl_perf_bug.t index fd86646..558b4f0 100644 --- a/t/zzzzzzz_perl_perf_bug.t +++ b/t/zzzzzzz_perl_perf_bug.t @@ -1,6 +1,7 @@ use strict; use warnings; use Test::More; +use Benchmark; use lib qw(t/lib); use DBICTest; # do not remove even though it is not used @@ -25,9 +26,6 @@ plan skip_all => plan skip_all => 'Skipping as AUTOMATED_TESTING is set' if ( $ENV{AUTOMATED_TESTING} ); -eval "use Benchmark ':all'"; -plan skip_all => 'needs Benchmark for testing' if $@; - plan tests => 3; ok( 1, 'Dummy - prevents next test timing out' );