X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xt%2Fauthor%2Fhttp-server.t;h=ffd95c0c3fbc553727d460ac0fd258b34943834d;hb=964bf130533c001789a80ef193f03d5c5f3817eb;hp=22852118d59320fbe5e97eb0f0899bae191f6174;hpb=807303a1658f895c41417beba24d24ff9b71c194;p=catagits%2FCatalyst-Runtime.git diff --git a/xt/author/http-server.t b/xt/author/http-server.t index 2285211..ffd95c0 100644 --- a/xt/author/http-server.t +++ b/xt/author/http-server.t @@ -9,34 +9,13 @@ use FindBin; use Net::EmptyPort qw(wait_port empty_port); use Try::Tiny; use Plack::Builder; - -eval { require Catalyst::Devel; Catalyst::Devel->VERSION(1.0); 1; } || do { - fail("Could not load Catalyst::Devel: $@"); - exit 1; -}; - -eval { require File::Copy::Recursive; 1 } || do { - fail("Could not load File::Copy::Recursive: $@"); - exit 1; -}; +use lib 't/lib'; +use MakeTestApp; # Run a single test by providing it as the first arg my $single_test = shift; -my $tmpdir = "$FindBin::Bin/../../t/tmp"; - -# clean up -rmtree $tmpdir if -d $tmpdir; - -# create a TestApp and copy the test libs into it -mkdir $tmpdir; -chdir $tmpdir; -system( $^X, "-I$FindBin::Bin/../../lib", "$FindBin::Bin/../../script/catalyst.pl", 'TestApp' ); -chdir "$FindBin::Bin/.."; -File::Copy::Recursive::dircopy( '../t/lib', '../t/tmp/TestApp/lib' ) or die; - -# remove TestApp's tests -rmtree '../t/tmp/TestApp/t' or die; +my $test_app_dir = make_test_app; # spawn the standalone HTTP server my $port = empty_port; @@ -48,7 +27,7 @@ if ($pid) { wait_port_timeout($port, 30); } elsif ($pid == 0) { # child process - unshift @INC, "$tmpdir/TestApp/lib", "$FindBin::Bin/../../lib"; + unshift @INC, "$test_app_dir/lib", "$FindBin::Bin/../../lib"; require TestApp; my $psgi_app = TestApp->apply_default_middlewares(TestApp->psgi_app); @@ -107,15 +86,11 @@ sub prove { if (!(my $pid = fork)) { require TAP::Harness; - my $aggr = -e '.aggregating'; my $harness = TAP::Harness->new({ - ($aggr ? (test_args => \@tests) : ()), lib => ['lib'], }); - my $aggregator = $aggr - ? $harness->runtests('t/aggregate.t') - : $harness->runtests(@tests); + my $aggregator = $harness->runtests(@tests); exit $aggregator->has_errors ? 1 : 0; } else {