Skip Menu |

This queue is for tickets about the Module-Install CPAN distribution.

Report information
The Basics
Id: 57973
Status: rejected
Priority: 0/
Queue: Module-Install

People
Owner: Nobody in particular
Requestors: gfuji [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] tests_recursive() doesn't register xt/
Hi, It seems that tests_recursive() should register xt/ (if memory serves, some version of M::I does so), but it doesn't. The attached patch will fix it without imcompatible changes. Note that the change in tests is reasonable, I think, because users should register tests in any cases. Regards, -- Goro Fuji (gfx) GFUJI at CPAN.org
Oh, sorry. I forgot to attach the patch. -- Goro Fuji (gfx) GFUJI at CPAN.org
Subject: fix-xt.patch
Index: t/13_author_tests.t =================================================================== --- t/13_author_tests.t (revision 12383) +++ t/13_author_tests.t (working copy) @@ -21,6 +21,7 @@ license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; +tests_recursive; WriteAll; END_DSL @@ -44,6 +45,7 @@ license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; +tests_recursive; WriteAll; END_DSL Index: lib/Module/Install/Makefile.pm =================================================================== --- lib/Module/Install/Makefile.pm (revision 12383) +++ lib/Module/Install/Makefile.pm (working copy) @@ -183,18 +183,34 @@ } sub tests_recursive { - my $self = shift; - my $dir = shift || 't'; - unless ( -d $dir ) { - die "tests_recursive dir '$dir' does not exist"; - } - my %tests = map { $_ => 1 } split / /, ($self->tests || ''); - require File::Find; - File::Find::find( + my($self, @dirs) = @_; + + @dirs = ('t') if !@dirs && -d 't'; + + if ( !$Module::Install::ExtraTests::use_extratests ) { + # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness. + # So, just ignore our xt tests here. + if ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { + push @dirs, 'xt'; + } + } + + foreach my $dir(@dirs) { + unless ( -d $dir ) { + die "tests_recursive dir '$dir' does not exist"; + } + } + + return unless @dirs; + + my %tests = map { $_ => 1 } split / /, ($self->tests || ''); + + require File::Find; + File::Find::find( sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 }, - $dir + @dirs ); - $self->tests( join ' ', sort keys %tests ); + $self->tests( join ' ', sort keys %tests ); } sub write { @@ -246,13 +262,6 @@ $args->{test} = { TESTS => (join ' ', grep {!$seen{$_}++} @tests), }; - } elsif ( $Module::Install::ExtraTests::use_extratests ) { - # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness. - # So, just ignore our xt tests here. - } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { - $args->{test} = { - TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ), - }; } if ( $] >= 5.005 ) { $args->{ABSTRACT} = $self->abstract;
tests_recursive() now ignores the xt/ directory intentionally to allow ::ExtraTests/AuthorTests to do what they want. So I reject to fix this. Thanks for the report anyway. On 2010-5-30 Sun 06:48:41, GFUJI wrote: Show quoted text
> Hi, > > It seems that tests_recursive() should register xt/ (if memory serves, > some version of M::I does so), but it doesn't. > > The attached patch will fix it without imcompatible changes. > Note that the change in tests is reasonable, I think, because users > should register tests in any cases. > > Regards,