[Rt-commit] rt branch, 4.0/skip-optional-deps-in-tests, created. rt-4.0.1-129-ga352dcd
Jason May
jasonmay at bestpractical.com
Mon Jul 25 20:29:28 EDT 2011
The branch, 4.0/skip-optional-deps-in-tests has been created
at a352dcd02801695192a80b5b24ba0fa7b0953503 (commit)
- Log -----------------------------------------------------------------
commit 9d37787909d935d0fcd1f4d8f97705436f9dad27
Author: Jason May <jasonmay at bestpractical.com>
Date: Mon Jul 25 19:43:10 2011 -0400
Require GnuPG::Interface at runtime to avoid premature imports
If GnuPG::Interface isn't installed (which is an optional dep),
RT will try to skip_all on any of those that aren't installed.
The problem is that RT::Crypt::GnuPG 'uses' GnuPG::Interface
before the skip_all takes place. Requiring after the skip_all
fixes that.
diff --git a/lib/RT/Test/GnuPG.pm b/lib/RT/Test/GnuPG.pm
index 6a3a937..56e748b 100644
--- a/lib/RT/Test/GnuPG.pm
+++ b/lib/RT/Test/GnuPG.pm
@@ -51,7 +51,6 @@ use strict;
use Test::More;
use base qw(RT::Test);
use File::Temp qw(tempdir);
-use RT::Crypt::GnuPG;
our @EXPORT =
qw(create_a_ticket update_ticket cleanup_headers set_queue_crypt_options
@@ -69,6 +68,7 @@ sub import {
$t->plan( skip_all => 'gpg executable is required.' )
unless RT::Test->find_executable('gpg');
+ require RT::Crypt::GnuPG;
$class->SUPER::import(%args);
RT::Test::diag "GnuPG --homedir " . RT->Config->Get('GnuPGOptions')->{'homedir'};
commit 727a221a6594c51e8eda9c09a3625aed4b4af11e
Author: Jason May <jasonmay at bestpractical.com>
Date: Mon Jul 25 20:25:02 2011 -0400
Pass skip_all into the test object if it's imported
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index e4933c2..1f09397 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -126,6 +126,9 @@ sub import {
elsif ( exists $args{'tests'} ) {
# do nothing if they say "tests => undef" - let them make the plan
}
+ elsif ( $args{'skip_all'} ) {
+ $class->builder->plan(skip_all => $args{'skip_all'});
+ }
else {
$class->builder->no_plan unless $class->builder->has_plan;
}
commit a352dcd02801695192a80b5b24ba0fa7b0953503
Author: Jason May <jasonmay at bestpractical.com>
Date: Mon Jul 25 20:25:34 2011 -0400
Skip chart tests if GD isn't installed
diff --git a/t/web/charting.t b/t/web/charting.t
index 5618762..32d95d9 100644
--- a/t/web/charting.t
+++ b/t/web/charting.t
@@ -1,7 +1,16 @@
use strict;
use warnings;
-use RT::Test no_plan => 1;
+BEGIN {
+ require RT::Test;
+
+ if (eval { require GD; 1 }) {
+ RT::Test->import(plan => 'no_plan');
+ }
+ else {
+ RT::Test->import(skip_all => 'GD required.');
+ }
+}
for my $n (1..7) {
my $ticket = RT::Ticket->new( RT->SystemUser );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list