From: Dan Brook Date: Fri, 13 Aug 2010 14:29:10 +0000 (+0100) Subject: Fix tests dying in absence of bootstrap scripts. X-Git-Tag: 0.002005 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df6292661bd22bb00ba89f0684b60bb8096383c8;p=catagits%2FGitalist.git Fix tests dying in absence of bootstrap scripts. --- diff --git a/t/01app.t b/t/01app.t index 171a349..c8a5260 100644 --- a/t/01app.t +++ b/t/01app.t @@ -1,6 +1,12 @@ #!/usr/bin/env perl use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use lib "$Bin/lib"; use TestGitalist; diff --git a/t/02git_CollectionOfRepositories_FromDirectory.t b/t/02git_CollectionOfRepositories_FromDirectory.t index 1a09bf9..7cea1a6 100644 --- a/t/02git_CollectionOfRepositories_FromDirectory.t +++ b/t/02git_CollectionOfRepositories_FromDirectory.t @@ -1,5 +1,11 @@ use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; use Test::More qw/no_plan/; diff --git a/t/02git_Repository.t b/t/02git_Repository.t index a0a6a09..4b5fd20 100644 --- a/t/02git_Repository.t +++ b/t/02git_Repository.t @@ -1,5 +1,11 @@ use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; use Test::More qw/no_plan/; diff --git a/t/02git_object.t b/t/02git_object.t index 2f5a4c8..0ea808a 100644 --- a/t/02git_object.t +++ b/t/02git_object.t @@ -1,5 +1,11 @@ use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; use Test::More; diff --git a/t/02git_util.t b/t/02git_util.t index a3fe51b..c281262 100644 --- a/t/02git_util.t +++ b/t/02git_util.t @@ -1,5 +1,11 @@ use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; use Test::More; diff --git a/t/03legacy_uri.t b/t/03legacy_uri.t index ff3609d..5e43455 100644 --- a/t/03legacy_uri.t +++ b/t/03legacy_uri.t @@ -1,6 +1,12 @@ #!/usr/bin/env perl use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use lib "$Bin/lib"; use TestGitalist qw/request curry_test_uri done_testing ok is $TODO/; diff --git a/t/app-mech-rootpage.t b/t/app-mech-rootpage.t index a51da3f..7d99e0d 100644 --- a/t/app-mech-rootpage.t +++ b/t/app-mech-rootpage.t @@ -1,6 +1,12 @@ #!/usr/bin/env perl use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use lib "$Bin/lib"; use TestGitalist; plan 'skip_all' => "One or more of the following modules aren't present: Test::WWW::Mechanize::Catalyst WWW::Mechanize::TreeBuilder HTML::TreeBuilder::XPath" unless MECH(); diff --git a/t/atom.t b/t/atom.t index bb50e26..c3f599a 100644 --- a/t/atom.t +++ b/t/atom.t @@ -1,6 +1,12 @@ #!/usr/bin/env perl use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use lib "$Bin/lib"; use TestGitalist; use HTTP::Request::Common; diff --git a/t/model_collectionofrepos.t b/t/model_collectionofrepos.t index ae1a6a9..493e287 100644 --- a/t/model_collectionofrepos.t +++ b/t/model_collectionofrepos.t @@ -1,5 +1,11 @@ use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; diff --git a/t/opml.t b/t/opml.t index 642e709..1b8ac02 100644 --- a/t/opml.t +++ b/t/opml.t @@ -1,6 +1,12 @@ #!/usr/bin/env perl use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use lib "$Bin/lib"; use TestGitalist; use HTTP::Request::Common; diff --git a/t/rss.t b/t/rss.t index ee72240..98a7faa 100644 --- a/t/rss.t +++ b/t/rss.t @@ -1,6 +1,12 @@ #!/usr/bin/env perl use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use lib "$Bin/lib"; use TestGitalist; use HTTP::Request::Common; diff --git a/t/scripts.t b/t/scripts.t index e39bd13..3e5eba6 100644 --- a/t/scripts.t +++ b/t/scripts.t @@ -1,5 +1,11 @@ use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings; diff --git a/t/view_Default.t b/t/view_Default.t index 07940ce..7031787 100644 --- a/t/view_Default.t +++ b/t/view_Default.t @@ -1,5 +1,11 @@ use FindBin qw/$Bin/; -BEGIN { do "$FindBin::Bin/../script/env" or die $@ } +BEGIN { + my $env = "$FindBin::Bin/script/env"; + if (-r $env) { + do $env or die $@; + } +} + use strict; use warnings;