-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
have the dependents test test all dependents
- Loading branch information
1 parent
ab5e42b
commit fcee97d
Showing
4 changed files
with
126 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
/PPI-*.tar.gz | ||
/nytprof* | ||
/TODO | ||
/xt/cpanfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package # | ||
DepReqs; | ||
|
||
use 5.010; | ||
use strictures 2; | ||
|
||
use Test::DependentModules; | ||
use IO::All; | ||
use MetaCPAN::Client; | ||
use List::Util 'uniqstr'; | ||
use Devel::Confess; | ||
|
||
1; | ||
|
||
__PACKAGE__->run unless caller; | ||
|
||
sub run { # synch with dependent-modules.t | ||
## force metacpan to actually return the whole dependents list | ||
# https://github.com/metacpan/metacpan-client/issues/122 | ||
my $old_fetch = \&MetaCPAN::Client::fetch; | ||
my $new_fetch = sub { $old_fetch->( shift, shift . "?size=5000", @_ ) }; | ||
{ no warnings 'redefine'; *MetaCPAN::Client::fetch = $new_fetch; } | ||
|
||
my @deps = Test::DependentModules::_get_deps PPI => { | ||
exclude => qr/^( | ||
# don't remember why i excluded these | ||
Apache2-SSI|Devel-IPerl|Padre | ||
# fails tests regarding directory write permissions, probably not PPI | ||
|Devel-Examine-Subs | ||
# their dependencies don't even install | ||
|Devel-ebug-HTTP|Padre-Plugin-ParserTool|Devel-PerlySense|PPI-Tester | ||
|Acme-ReturnValue|Bot-BasicBot-Pluggable-Module-Gitbot|Pinwheel | ||
|Dist-Zilla-Plugin-MetaProvides-Package|Dist-Zilla-Plugin-Readme-Brief | ||
|Apache2-PPI-HTML | ||
# author parsing issue | ||
|Spellunker-Perl | ||
# takes too long | ||
|RPerl | ||
)$/x | ||
}; | ||
|
||
{ no warnings 'redefine'; *MetaCPAN::Client::fetch = $old_fetch; } | ||
|
||
my $c = MetaCPAN::Client->new; | ||
my @reqs; | ||
for my $dependent (@deps) { | ||
say $dependent; | ||
my @dep_reqs = map @{ $c->release($_)->dependency }, $dependent; | ||
say " $_->{module}" for @dep_reqs; | ||
push @reqs, @dep_reqs; | ||
} | ||
|
||
say "writing file"; | ||
io("xt/cpanfile") | ||
->print( join "\n", | ||
uniqstr map qq[requires "$_->{module}" => "$_->{version}";], @reqs ); | ||
|
||
say "debug printing file"; | ||
say io("xt/cpanfile")->all; | ||
|
||
# test early that all modules don't have an author that crashes tests later | ||
# !!! careful, this changes CWD !!! | ||
Test::DependentModules::_load_cpan; | ||
for my $name (@deps) { | ||
my $mod = $name; | ||
$mod =~ s/-/::/g; | ||
next unless # | ||
my $dist = Test::DependentModules::_get_distro($mod); | ||
$dist->author->id; | ||
} | ||
|
||
say "done"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,50 @@ | ||
use strict; | ||
use warnings; | ||
use Test2::V0; | ||
use strictures 2; | ||
|
||
use Test::DependentModules qw( test_modules ); | ||
use Test::More; | ||
use Test::DependentModules 'test_all_dependents'; | ||
use MetaCPAN::Client; | ||
use Devel::Confess; | ||
|
||
my @modules = ('Perl::Critic'); | ||
# synch with DepReqs.pm | ||
|
||
SKIP: { | ||
skip '$ENV{TEST_DEPENDENTS} not set', scalar @modules | ||
unless $ENV{TEST_DEPENDENTS}; | ||
test_modules(@modules); | ||
skip_all "ENV var TEST_DEPENDENTS not set" if not $ENV{TEST_DEPENDENTS}; | ||
|
||
} | ||
# duplicate error output into an array for later printing | ||
my @error_log; | ||
my $old_log = \&Test::DependentModules::_error_log; | ||
my $new_log = sub { push @error_log, @_; $old_log->(@_); }; | ||
{ no warnings 'redefine'; *Test::DependentModules::_error_log = $new_log; } | ||
|
||
done_testing(); | ||
# force metacpan to actually return the whole dependents list | ||
# https://github.com/metacpan/metacpan-client/issues/122 | ||
my $old_fetch = \&MetaCPAN::Client::fetch; | ||
my $new_fetch = sub { $old_fetch->( shift, shift . "?size=5000", @_ ) }; | ||
{ no warnings 'redefine'; *MetaCPAN::Client::fetch = $new_fetch; } | ||
|
||
test_all_dependents PPI => { | ||
exclude => qr/^( | ||
# don't remember why i excluded these | ||
Apache2-SSI|Devel-IPerl|Padre | ||
# fails tests regarding directory write permissions, probably not PPI | ||
|Devel-Examine-Subs | ||
# their dependencies don't even install | ||
|Devel-ebug-HTTP|Padre-Plugin-ParserTool|Devel-PerlySense|PPI-Tester | ||
|Acme-ReturnValue|Bot-BasicBot-Pluggable-Module-Gitbot|Pinwheel | ||
|Dist-Zilla-Plugin-MetaProvides-Package|Dist-Zilla-Plugin-Readme-Brief | ||
|Apache2-PPI-HTML | ||
# author parsing issue | ||
|Spellunker-Perl | ||
# takes too long | ||
|RPerl | ||
)$/x | ||
}; | ||
|
||
my $error_log = join "\n", @error_log; | ||
my @fails = $error_log =~ /(FAIL: .*\w+)$/gs; | ||
|
||
diag "\n\n---------- ERROR LOG START -----------\n\n", | ||
@error_log, | ||
"\n\n---------- FAILS: -----------\n\n", | ||
@fails, | ||
"\n\n---------- ERROR LOG END -----------\n\n"; | ||
done_testing; |