remove GeoIP2 from broken dependent list
[gitmo/Moo.git] / xt / test-my-dependents.t
CommitLineData
dcc862ca 1use Test::More;
2BEGIN {
3 plan skip_all => <<'END_HELP' unless $ENV{MOO_TEST_MD};
4This test will not run unless you set MOO_TEST_MD to a true value.
5
6 Valid values are:
7
8 all Test every dist which depends on Moose except those
9 that we know cannot be tested. This is a lot of
10 distros (hundreds).
11
12 Dist::1,Dist::2,... Test the individual dists listed.
13
14 MooX Test all Moo extension distros.
15
16 1 Run the default tests. We pick 200 random dists and
17 test them.
18END_HELP
19}
20
37d01587 21use Test::DependentModules qw( test_module );
dcc862ca 22use MetaCPAN::API;
23use List::Util ();
24
4c58e020 25# avoid any modules that depend on these
26my @bad_prereqs = qw(Gtk2 Padre Wx);
27
dcc862ca 28my $mcpan = MetaCPAN::API->new;
29my $res = $mcpan->post(
30 '/search/reverse_dependencies/Moo' => {
31 query => {
32 filtered => {
33 query => { "match_all" => {} },
34 filter => {
35 and => [
36 { term => { 'release.status' => 'latest' } },
37 { term => { 'release.authorized' => \1 } },
4c58e020 38 { not => { filter => {
39 or => [
40 map { { term => { 'dependency.module' => $_ } } } @bad_prereqs,
41 ],
42 } } }
dcc862ca 43 ],
44 },
45 },
46 },
47 size => 5000,
4c58e020 48 fields => ['distribution', 'provides', 'metadata.provides'],
dcc862ca 49 },
50);
51
15f328f0 52my %bad_dist;
37d01587 53my $sec_reason;
54my %skip;
55my %todo;
56
57my $hash;
58for my $line (<DATA>) {
dcc862ca 59 chomp $line;
37d01587 60 next unless $line =~ /\S/;
61 if ( $line =~ /^#\s*(\w+)(?::\s*(.*?)\s*)?$/ ) {
62 die "Invalid action in DATA section ($1)"
63 unless $1 eq 'SKIP' || $1 eq 'TODO';
64 $hash = $1 eq 'SKIP' ? \%skip : \%todo;
65 $sec_reason = $2;
dcc862ca 66 }
37d01587 67
68 my ( $dist, $reason ) = $line =~ /^(\S*)\s*(?:#\s*(.*?)\s*)?$/;
69 next unless defined $dist && length $dist;
70
71 $hash->{$dist} = $reason || $sec_reason;
dcc862ca 72}
73
37d01587 74my %todo_module;
75my @modules;
76for my $hit (@{ $res->{hits}{hits} }) {
77 my $dist = $hit->{fields}{distribution};
78 next
79 if exists $skip{$dist};
80 next
81 if $dist =~ /^(?:Task|Bundle|Acme)-/;
82
83 my $module = (sort { length $a <=> length $b || $a cmp $b } do {
bbecfc66 84 if (my $provides = $hit->{fields}{provides}) {
15f328f0 85 ref $provides ? @$provides : ($provides);
86 }
bbecfc66 87 elsif (my $provides = $hit->{fields}{'metadata.provides'}) {
15f328f0 88 keys %$provides;
89 }
90 else {
91 (my $module = $dist) =~ s/-/::/g;
92 ($module);
93 }
37d01587 94 })[0];
95 $todo_module{$module} = $todo{$dist}
96 if exists $todo{$dist};
97 push @modules, $module;
98 $module;
99}
100@modules = sort @modules;
dcc862ca 101
102if ( $ENV{MOO_TEST_MD} eq 'MooX' ) {
103 @modules = grep /^MooX(?:$|::)/, @modules;
104}
105elsif ( $ENV{MOO_TEST_MD} eq '1' ) {
106 diag(<<'EOF');
107 Picking 200 random dependents to test. Set MOO_TEST_MD=all to test all
108 dependents or MOO_TEST_MD=MooX to test extension modules only.
109EOF
110 @modules = (List::Util::shuffle(@modules))[0..199];
111}
112elsif ( $ENV{MOO_TEST_MD} ne 'all' ) {
113 my @chosen = split /,/, $ENV{MOO_TEST_MD};
114 my %modules = map { $_ => 1 } @modules;
115 if (my @unknown = grep { !$modules{$_} } @chosen) {
bbecfc66 116 die "Unknown modules: @unknown";
dcc862ca 117 }
118 @modules = @chosen;
119}
120
15f328f0 121if (grep { $_ eq '--show' } @ARGV) {
37d01587 122 print "Dependents:\n";
15f328f0 123 print " $_\n" for @modules;
124 exit;
125}
126
dcc862ca 127plan tests => scalar @modules;
37d01587 128for my $module (@modules) {
129 local $TODO = $todo_module{$module} || '???'
130 if exists $todo_module{$module};
131 test_module($module);
132}
133
dcc862ca 134
135__DATA__
37d01587 136
137# SKIP: no tests
15f328f0 138CPAN-Mirror-Finder
139Catmandu-AlephX
140Device-Hue
141Novel-Robot
142Novel-Robot-Browser
143Novel-Robot-Parser
144Thrift-API-HiveClient
145Tiezi-Robot-Parser
4c58e020 146
37d01587 147# SKIP: broken
15f328f0 148App-Presto
149Catmandu-Store-Lucy
150Dancer2-Session-Sereal
151Data-Localize
152HTML-Zoom-Parser-HH5P
153Message-Passing-ZeroMQ
4c58e020 154Tak
155
37d01587 156# SKIP: broken tests
15f328f0 157Template-Flute
158Uninets-Check-Modules-HTTP
159Uninets-Check-Modules-MongoDB
160Uninets-Check-Modules-Redis
4c58e020 161
37d01587 162# SKIP: missing prereqs
15f328f0 163Catmandu-Z3950
164Tiezi-Robot
4c58e020 165
37d01587 166# SKIP: bad prereq version listed
15f328f0 167Dancer2-Session-Cookie
168Dancer2-Session-JSON
4c58e020 169
37d01587 170# TODO: broken, pending release
15f328f0 171Hg-Lib
172P9Y-ProcessTable
4c58e020 173
37d01587 174# SKIP: OS specific
15f328f0 175Linux-AtaSmart
dcc862ca 176
37d01587 177# TODO: broken by Moo change
15f328f0 178Math-Rational-Approx # RT#84035
179App-Services # RT#85255