Skip Menu |

This queue is for tickets about the Test-NoWarnings CPAN distribution.

Report information
The Basics
Id: 55918
Status: open
Priority: 0/
Queue: Test-NoWarnings

People
Owner: Nobody in particular
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.01
Fixed in: (no value)



Subject: Test::NoWarnings should override CORE::Global::warn rather than catch signals
Test::NoWarnings should override CORE::Global::warn rather than catch signals. Right now if one of the tests or it's dependents localizes or alters $SIG{__WARN__}, then the warning is not captured. This is evidenced by this test of Exporter's creative alteration of $SIG{__WARN__} In the below test, the warning message is never trapped. -- package foo; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(bar); sub bar {1}; package main; BEGIN { use warnings; use Test::More tests => 2; use Test::NoWarnings; } import foo; sub bar {2}; is(bar(), 1);
Subject: Re: [rt.cpan.org #55918] Test::NoWarnings should override CORE::Global::warn rather than catch signals
Date: Thu, 25 Mar 2010 15:07:38 +1100
To: bug-Test-NoWarnings [...] rt.cpan.org
From: Adam Kennedy <adamkennedybackup [...] gmail.com>
I believe this can be considered intentional. We're not looking for any warnings in the purest sense, we're looking for any uncaught warnings (stuff that will be visible to the user and fill up your apache logs). Adam K On 25 March 2010 10:42, Todd Rinaldo via RT <bug-Test-NoWarnings@rt.cpan.org> wrote: Show quoted text
> Wed Mar 24 19:42:53 2010: Request 55918 was acted upon. > Transaction: Ticket created by TODDR >       Queue: Test-NoWarnings >     Subject: Test::NoWarnings should override CORE::Global::warn rather than >  catch signals >   Broken in: 1.01 >    Severity: Normal >       Owner: Nobody >  Requestors: TODDR@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55918 > > > > Test::NoWarnings should override CORE::Global::warn rather than catch signals. > > Right now if one of the tests or it's dependents localizes or alters $SIG{__WARN__}, then the > warning is not captured. This is evidenced by this test of Exporter's creative alteration of > $SIG{__WARN__} > > In the below test, the warning message is never trapped. > > -- > > package foo; > require Exporter; > @ISA = qw(Exporter); > @EXPORT = qw(bar); > sub bar {1}; > > package main; > > BEGIN { >  use warnings; >  use Test::More tests => 2; >  use Test::NoWarnings; > } > > import foo; > sub bar {2}; > > is(bar(), 1); > >
On Thu Mar 25 00:07:51 2010, adam@ali.as wrote: Show quoted text
> I believe this can be considered intentional. > > We're not looking for any warnings in the purest sense, we're looking > for any uncaught warnings (stuff that will be visible to the user and > fill up your apache logs). > > Adam K
Yes but in this case, we missed a problem that could have been detected much earlier if some of the dependent modules' tests had gone off due to this. https://rt.cpan.org/Public/Bug/Display.html?id=55901 If we override the global warn, we're catching all places where the exceptions, caught or not are printed via the warn stream. In the above case, $SIG{__WARN__} was intercepted so they could enhance the warn with a carp: local $SIG{__WARN__} = sub {require Carp; &Carp::carp}; This is something we would have wanted to catch.
Subject: Re: [rt.cpan.org #55918] Test::NoWarnings should override CORE::Global::warn rather than catch signals
Date: Thu, 25 Mar 2010 13:31:46 +0000
To: bug-Test-NoWarnings [...] rt.cpan.org
From: Fergal Daly <fergal [...] esatclear.ie>
I don't have strong feelings either way except that changing long-standing behaviour is usually disruptive. It seems this could be an option at import time e.g. use Test::NoWarnings qw ( core sig ); would result in capturing both.
RT-Send-CC: adamkennedybackup [...] gmail.com, fergal [...] esatclear.ie
On Thu Mar 25 09:31:59 2010, fergal@esatclear.ie wrote: Show quoted text
> I don't have strong feelings either way except that changing > long-standing behaviour is usually disruptive. It seems this could be > an option at import time > > e.g. > > use Test::NoWarnings qw ( core sig ); > > would result in capturing both.
If/when I find time I'll pass a patch for this. In the mean time, I've gotten p5p to accept a patch to Exporter so my need is not as strong at the moment: http://rt.perl.org/rt3/Public/Bug/Display.html?id=73794