[Rt-commit] rt branch, 4.2/nowarnings-skip-tests, created. rt-4.2.13-74-g7d55aee
Alex Vandiver
alexmv at bestpractical.com
Fri Dec 23 01:01:43 EST 2016
The branch, 4.2/nowarnings-skip-tests has been created
at 7d55aee8ff3498cbbaa8be21ae786dc7b3a49429 (commit)
- Log -----------------------------------------------------------------
commit 7d55aee8ff3498cbbaa8be21ae786dc7b3a49429
Author: Alex Vandiver <alex at chmrr.net>
Date: Thu Dec 22 21:54:29 2016 -0800
Ensure that Test::NoWarnings is skipped if skip_all is used
The RT::Test subclasses use `$class->builder->plan(skip_all => ...)`
to skip all tests when their dependencies are not met. However,
`RT::Test`s DESTROY method still runs Test::NoWarnings' tests unless
`RT::Test::plan` saw the `skip_all`. Calling the builder's `plan`
directly leads to:
```
$ prove -wlv t/web/gnupg-select-keys-on-update.t
t/web/gnupg-select-keys-on-update.t ..
1..0 # SKIP GnuPG required.
ok 1 - no warnings
skipped: GnuPG required.
Test Summary Report
-------------------
t/web/gnupg-select-keys-on-update.t (Wstat: 0 Tests: 1 Failed: 1)
Failed test: 1
Parse errors: Bad plan. You planned 0 tests but ran 1.
Files=1, Tests=1, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.06 cusr 0.00 csys = 0.08 CPU)
Result: FAIL
```
Explicitly call `RT::Test::plan(...)` instead of
`$class->builder->plan(...)` to ensure that RT::Test is aware that
Test::NoWarnings should be skipped as well. This mirrors the existing
pattern in RT::Test::Shredder.
diff --git a/lib/RT/Test/GnuPG.pm b/lib/RT/Test/GnuPG.pm
index 7419572..d5867bb 100644
--- a/lib/RT/Test/GnuPG.pm
+++ b/lib/RT/Test/GnuPG.pm
@@ -64,9 +64,9 @@ sub import {
my %args = @_;
my $t = $class->builder;
- $t->plan( skip_all => 'GnuPG required.' )
+ RT::Test::plan( skip_all => 'GnuPG required.' )
unless GnuPG::Interface->require;
- $t->plan( skip_all => 'gpg executable is required.' )
+ RT::Test::plan( skip_all => 'gpg executable is required.' )
unless RT::Test->find_executable('gpg');
$class->SUPER::import(%args);
diff --git a/lib/RT/Test/SMIME.pm b/lib/RT/Test/SMIME.pm
index 36b4362..c299b79 100644
--- a/lib/RT/Test/SMIME.pm
+++ b/lib/RT/Test/SMIME.pm
@@ -61,7 +61,7 @@ sub import {
my %args = @_;
my $t = $class->builder;
- $t->plan( skip_all => 'openssl executable is required.' )
+ RT::Test::plan( skip_all => 'openssl executable is required.' )
unless RT::Test->find_executable('openssl');
require RT::Crypt;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list