Skip Menu |

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

Report information
The Basics
Id: 84073
Status: open
Priority: 0/
Queue: Test-Group

People
Owner: Nobody in particular
Requestors: otting [...] cpanel.net
Cc:
AdminCc:

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



Subject: TODOs inside test groups do not work properly (Patch included)
Date: Tue, 19 Mar 2013 11:57:01 -0500
To: bug-Test-Group [...] rt.cpan.org
From: James Otting <otting [...] cpanel.net>
Module: Test::Group 0.18 perl 5.10.1 on Centos 6.4 TODOs inside test groups are not properly marked as such in TAP output, causing them to show as failures. This is the same issue as reported in rt by Dvaid Storrs in June of 2011. I've found and (I believe) fixed the issue. A patch is included below. --- Test/Group.pm 2013-03-14 17:01:39.275840601 -0500 +++ Test/Group.pm 2013-03-14 17:02:43.041718993 -0500 @@ -457,16 +457,9 @@ no warnings "redefine"; my ($OK, $TODO_string) = $subTest->as_Test_Builder_params; - # I tried to put a "local $TODO = " here, but that didn't work and - # I lack the patience to dig up the whole story about - # Test::Builder->caller not doing The Right Thing here (yet - # elsewhere it does when it apparently shouldn't, e.g. in - # L</run>). So here goes a sleazy local-method trick to get the - # TODO status across to Test::Builder; the trick has an adherence - # in L</ok>, which see. - local *Test::Builder::todo = sub { $TODO_string }; - local $Test::Builder::Level = $Test::Builder::Level + $Level; + $Test->todo_start($TODO_string); $Test->ok($OK, $name); + $Test->todo_end(); return $OK ? 1 : 0; } This fix appears to work properly for test structures like the following. #!/usr/bin/perl use Test::More tests => 2; use Test::Group; test "something" => sub { pass("Ok"); TODO: { local $TODO = "this part does not work yet"; fail("Expected fail"); } pass("Works"); }; pass("Works");
On Tue Mar 19 12:57:18 2013, otting@cpanel.net wrote: Show quoted text
> Module: Test::Group 0.18 > perl 5.10.1 on Centos 6.4 > > TODOs inside test groups are not properly marked as such in TAP output, > causing them to show as failures. This is the same issue as reported in > rt by Dvaid Storrs in June of 2011. I've found and (I believe) fixed the > issue. A patch is included below. > > > --- Test/Group.pm 2013-03-14 17:01:39.275840601 -0500 > +++ Test/Group.pm 2013-03-14 17:02:43.041718993 -0500 > @@ -457,16 +457,9 @@ > > no warnings "redefine"; > my ($OK, $TODO_string) = $subTest->as_Test_Builder_params; > - # I tried to put a "local $TODO = " here, but that didn't work and > - # I lack the patience to dig up the whole story about > - # Test::Builder->caller not doing The Right Thing here (yet > - # elsewhere it does when it apparently shouldn't, e.g. in > - # L</run>). So here goes a sleazy local-method trick to get the > - # TODO status across to Test::Builder; the trick has an adherence > - # in L</ok>, which see. > - local *Test::Builder::todo = sub { $TODO_string }; > - local $Test::Builder::Level = $Test::Builder::Level + $Level; > + $Test->todo_start($TODO_string); > $Test->ok($OK, $name); > + $Test->todo_end(); > return $OK ? 1 : 0; > } > > > This fix appears to work properly for test structures like the following. > > #!/usr/bin/perl > > use Test::More tests => 2; > use Test::Group; > > test "something" => sub { > pass("Ok"); > TODO: { > local $TODO = "this part does not work yet"; > fail("Expected fail"); > } > pass("Works"); > }; > pass("Works");
Thanks. There was already a fix for this in the git repo, but it had never been released. I've added your example as a test case and released it to the CPAN Testers as version 0.18_1 You can fetch it from http://search.cpan.org/CPAN/authors/id/N/NC/NCLEATON/Test-Group-0.18_1.tar.gz if you like. If no issues arise I'll release it as 0.19 in a couple of days. I'll leave this ticket open until then. Nick
Subject: Re: [rt.cpan.org #84073] TODOs inside test groups do not work properly (Patch included)
Date: Mon, 25 Mar 2013 16:29:33 -0500
To: bug-Test-Group [...] rt.cpan.org
From: James Otting <otting [...] cpanel.net>
On 03/23/2013 11:05 AM, NCLEATON via RT wrote: Show quoted text
> > Thanks. > > There was already a fix for this in the git repo, but it had never been released. I've added your example as a test case and released it to the CPAN Testers as version 0.18_1 > > You can fetch it from http://search.cpan.org/CPAN/authors/id/N/NC/NCLEATON/Test-Group-0.18_1.tar.gz if you like. > > If no issues arise I'll release it as 0.19 in a couple of days. I'll leave this ticket open until then. > > > Nick >
Sorry, didn't realize there was a git version to look at, or I would've checked there first. Glad to hear it's getting fixed and released though, as that'll make our deployment easier. I'm running 0.18_1 now on my development box and it looks to have corrected this issue nicely. Haven't run into any other problems with it either. Thanks for being on this so quickly! --James