From 83fedde4cde6539386c9d3ecf37fb99d74af8d93 Mon Sep 17 00:00:00 2001 From: "e@80x24.org" Date: Sat, 26 Dec 2015 23:38:17 +0000 Subject: [PATCH] tests: fixup requirements for tests We should be able to run tests on bare bones systems more easily. --- t/msgmap.t | 5 +++++ t/nntp.t | 5 +++++ t/nntpd.t | 10 ++++++---- t/plack.t | 15 +++++++-------- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/t/msgmap.t b/t/msgmap.t index 9c7352ac..6a4f4f84 100644 --- a/t/msgmap.t +++ b/t/msgmap.t @@ -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); diff --git a/t/nntp.t b/t/nntp.t index c9178882..388620e5 100644 --- 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'; { diff --git a/t/nntpd.t b/t/nntpd.t index ecb876f9..f6f71a22 100644 --- 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; diff --git a/t/plack.t b/t/plack.t index 31ec58da..6c7edb5d 100644 --- 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"); -- 2.44.0