]> Sergey Matveev's repositories - public-inbox.git/commitdiff
tests: fixup requirements for tests
authore@80x24.org <e@80x24.org>
Sat, 26 Dec 2015 23:38:17 +0000 (23:38 +0000)
committerEric Wong <e@80x24.org>
Sat, 26 Dec 2015 23:46:08 +0000 (23:46 +0000)
We should be able to run tests on bare bones systems more easily.

t/msgmap.t
t/nntp.t
t/nntpd.t
t/plack.t

index 9c7352acfe2747af121f8bfa94bd3c66c247a75b..6a4f4f84247190a3f7f83f240d109ac2e8741a89 100644 (file)
@@ -5,6 +5,11 @@ use warnings;
 use Test::More;
 use File::Temp qw/tempdir/;
 
+foreach my $mod (qw(DBD::SQLite)) {
+       eval "require $mod";
+       plan skip_all => "$mod missing for nntpd.t" if $@;
+}
+
 use_ok 'PublicInbox::Msgmap';
 my $tmpdir = tempdir(CLEANUP => 1);
 my $d = PublicInbox::Msgmap->new($tmpdir, 1);
index c91788820d8fbeb5ffc08091da5a5ffc0c912322..388620e550c26db752f5b75f15d02fe05e257c28 100644 (file)
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -5,6 +5,11 @@ use warnings;
 use Test::More;
 use Data::Dumper;
 
+foreach my $mod (qw(DBD::SQLite Search::Xapian Danga::Socket)) {
+       eval "require $mod";
+       plan skip_all => "$mod missing for nntp.t" if $@;
+}
+
 use_ok 'PublicInbox::NNTP';
 
 {
index ecb876f9d49dd9b0f32dbc947a6c98d5b3153782..f6f71a220e0d2c47b1a17028b584d8bdb51e4986 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -3,10 +3,12 @@
 use strict;
 use warnings;
 use Test::More;
-eval { require PublicInbox::SearchIdx };
-plan skip_all => "Xapian missing for nntpd" if $@;
-eval { require PublicInbox::Msgmap };
-plan skip_all => "DBD::SQLite missing for nntpd" if $@;
+foreach my $mod (qw(DBD::SQLite Search::Xapian Danga::Socket)) {
+       eval "require $mod";
+       plan skip_all => "$mod missing for nntpd.t" if $@;
+}
+require PublicInbox::SearchIdx;
+require PublicInbox::Msgmap;
 use Cwd;
 use Email::Simple;
 use IO::Socket;
index 31ec58daa99761eff6e9a1664a60c3391711f066..6c7edb5db42b65001091d3f133ee77e141e772d9 100644 (file)
--- a/t/plack.t
+++ b/t/plack.t
@@ -21,14 +21,13 @@ my $cfgpfx = "publicinbox.test";
 my $failbox = "$home/fail.mbox";
 local $ENV{PI_EMERGENCY} = $failbox;
 
-our $have_plack;
-eval {
-       require Plack::Request;
-       eval 'use Plack::Test; use HTTP::Request::Common';
-       $have_plack = 1;
-};
-SKIP: {
-       skip 'Plack not installed', 1 unless $have_plack;
+foreach my $mod (qw(Plack::Test HTTP::Request::Common
+                        Mail::Thread URI::Escape)) {
+       eval "require $mod";
+       plan skip_all => "$mod missing for plack.t" if $@;
+}
+
+{
        ok(-f $psgi, "psgi example file found");
        ok(-x "$main_bin/spamc",
                "spamc ham mock found (run in top of source tree");