From: Florian Ragwitz Date: Thu, 8 Jan 2009 12:06:50 +0000 (+0000) Subject: Make the optional tests bail out as early as possible if they're not enabled. X-Git-Tag: 5.8000_05~36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=4853fb50e3c7138bbe513fed2b22574a2d988ed1 Make the optional tests bail out as early as possible if they're not enabled. --- diff --git a/t/optional_http-server-restart.t b/t/optional_http-server-restart.t index 1e163ba..e004ac8 100644 --- a/t/optional_http-server-restart.t +++ b/t/optional_http-server-restart.t @@ -3,16 +3,19 @@ use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP}; +} + use File::Path; use FindBin; use LWP::Simple; use IO::Socket; use IPC::Open3; -use Test::More; use Time::HiRes qw/sleep/; eval "use Catalyst::Devel 1.0;"; -plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP}; plan skip_all => 'Catalyst::Devel required' if $@; plan skip_all => 'Catalyst::Devel >= 1.04 required' if $Catalyst::Devel::VERSION <= 1.03; eval "use File::Copy::Recursive"; diff --git a/t/optional_http-server.t b/t/optional_http-server.t index 4f006b2..60f9259 100644 --- a/t/optional_http-server.t +++ b/t/optional_http-server.t @@ -1,13 +1,16 @@ use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP}; +} + use File::Path; use FindBin; use IPC::Open3; use IO::Socket; -use Test::More; -plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP}; eval "use Catalyst::Devel 1.0"; plan skip_all => 'Catalyst::Devel required' if $@; eval "use File::Copy::Recursive"; diff --git a/t/optional_lighttpd-fastcgi-non-root.t b/t/optional_lighttpd-fastcgi-non-root.t index 5f8ba1b..db191f3 100644 --- a/t/optional_lighttpd-fastcgi-non-root.t +++ b/t/optional_lighttpd-fastcgi-non-root.t @@ -3,14 +3,16 @@ use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_LIGHTTPD to enable this test' + unless $ENV{TEST_LIGHTTPD}; +} + use File::Path; use FindBin; use IO::Socket; -use Test::More; -plan skip_all => 'set TEST_LIGHTTPD to enable this test' - unless $ENV{TEST_LIGHTTPD}; - eval "use FCGI"; plan skip_all => 'FCGI required' if $@; diff --git a/t/optional_lighttpd-fastcgi.t b/t/optional_lighttpd-fastcgi.t index c09e0ca..98567f7 100644 --- a/t/optional_lighttpd-fastcgi.t +++ b/t/optional_lighttpd-fastcgi.t @@ -3,14 +3,16 @@ use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_LIGHTTPD to enable this test' + unless $ENV{TEST_LIGHTTPD}; +} + use File::Path; use FindBin; use IO::Socket; -use Test::More; -plan skip_all => 'set TEST_LIGHTTPD to enable this test' - unless $ENV{TEST_LIGHTTPD}; - eval "use FCGI"; plan skip_all => 'FCGI required' if $@; diff --git a/t/optional_memleak.t b/t/optional_memleak.t index f420ef1..ba193a3 100644 --- a/t/optional_memleak.t +++ b/t/optional_memleak.t @@ -3,15 +3,16 @@ use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_MEMLEAK to enable this test' + unless $ENV{TEST_MEMLEAK}; +} + use FindBin; use lib "$FindBin::Bin/lib"; - -use Test::More; use Catalyst::Test 'TestApp'; -plan skip_all => 'set TEST_MEMLEAK to enable this test' - unless $ENV{TEST_MEMLEAK}; - eval "use Proc::ProcessTable"; plan skip_all => 'Proc::ProcessTable required for this test' if $@; diff --git a/t/optional_stress.t b/t/optional_stress.t index c0f2597..c4ccee2 100644 --- a/t/optional_stress.t +++ b/t/optional_stress.t @@ -3,18 +3,19 @@ use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_STRESS to enable this test' + unless $ENV{TEST_STRESS}; +} + use FindBin; use lib "$FindBin::Bin/lib"; - -use Test::More; use Catalyst::Test 'TestApp'; our ( $iters, $tests ); BEGIN { - plan skip_all => 'set TEST_STRESS to enable this test' - unless $ENV{TEST_STRESS}; - eval "use YAML"; plan skip_all => 'YAML is required for this test' if $@; diff --git a/t/optional_threads.t b/t/optional_threads.t index 05b4c96..baa4089 100644 --- a/t/optional_threads.t +++ b/t/optional_threads.t @@ -3,18 +3,19 @@ use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_THREADS to enable this test' + unless $ENV{TEST_THREADS}; +} + use FindBin; use lib "$FindBin::Bin/lib"; - -use Test::More; use Catalyst::Test 'TestApp'; use Catalyst::Request; use Config; use HTTP::Response; -plan skip_all => 'set TEST_THREADS to enable this test' - unless $ENV{TEST_THREADS}; - if ( $Config{useithreads} && !$ENV{CATALYST_SERVER} ) { require threads; plan tests => 3;