[Rt-commit] rt branch, 4.2/test-dependecies-warning, created. rt-4.2.0rc3-2-gdca0996

Alex Vandiver alexmv at bestpractical.com
Thu Sep 26 14:18:30 EDT 2013


The branch, 4.2/test-dependecies-warning has been created
        at  dca09964ef0253363df3c419c6848bc7e63a1475 (commit)

- Log -----------------------------------------------------------------
commit ff15f21d38ff3e042cbc27e818288da98b7111f9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Sep 26 14:12:06 2013 -0400

    Ensure that changes to the __WARN__ handler in included modules to not leak
    
    60068e5 introduced the Test::NoWarnings module, to ensure that tests are
    warnings-clean.  However, that module contains logic which runs as soon
    as it is require'd which overrides the __WARN__ handler.  Since the
    dependency tester attempts to load every module, this caused all
    warnings after Test::NoWarnings was loaded to disappear.
    
    Wrap the 'use ModuleName' in a block which local's the warnings handler,
    to prevent such changes from leaking.

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index e842c09..ac43490 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -443,7 +443,7 @@ sub test_dep {
         print $module, ': ', $version || 0, "\n"; 
     }
     else {
-        eval "use $module $version ()";
+        eval "{ local \$ENV{__WARN__}; use $module $version () }";
         if ( my $error = $@ ) {
             return 0 unless wantarray;
 

commit dca09964ef0253363df3c419c6848bc7e63a1475
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Sep 26 14:15:36 2013 -0400

    Warnings cleanup in rt-test-dependencies
    
    The logic added in 6a32fc5 to not display the full @INC path produces
    warnings if the error is already undef due to the module existing, but
    being too early a version.  This warning was often hidden due to calling
    with --with-developer, which loaded Test::NoWarnings and thus silenced
    the warning (see ff15f21).
    
    Protect the regex with an defined-ness check.

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index ac43490..45a78bb 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -453,7 +453,7 @@ sub test_dep {
 
             my $path = $module;
             $path =~ s{::}{/}g;
-            undef $error if $error =~ /^Can't locate $path\.pm in \@INC/;
+            undef $error if defined $error and $error =~ /^Can't locate $path\.pm in \@INC/;
 
             return ( 0, $error );
         }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list