develooper Front page | perl.qa | Postings from April 2015

Re: Test::More, what we hope to achieve doc.

Thread Previous | Thread Next
From:
Martin J. Evans
Date:
April 14, 2015 07:46
Subject:
Re: Test::More, what we hope to achieve doc.
Message ID:
552CC5C7.30502@easysoft.com
On 12/04/15 22:14, Chad Granum wrote:
> Thanks for the feedback!
>
> A few people have asked for a transition document like what you are
> asking for, I have yet to write it, but it is on my list.
>
> The main thing for a darkpan maintainer to do is this:
>
> Run all your tests against the latest dev release on cpan
> (https://metacpan.org/release/EXODIST/Test-Simple-1.301001_100). This
> can easily be done with a local::lob if you do not want to actually
> install it. If all your tests pass then there is nothing you need to
> do, everything just works. If this is the case please mention it
> somewhere, such as on this list. So far I have gotten only a handful
> of darkpan results, none of them reporting anything broken. It would
> be nice if there was a public list of darkpan results I can keep, and
> I may start one on github.
>
> If something is broken it would be best to send me a bug report on
> github. My goal is to break as little as possible, so if I do break
> something for you I would prefer fixing it over making you change you
> things. The only exceptions are when things are very crazy: Replacing
> the Test::Builder singleton, or breaking encapsulation by directly
> accessing hash keys of the Test::Builder object. The new stuff even
> goes so far as to support legacy monkeypatching of key methods in the
> Test::Builder namespace.
>
> -Chad

Hi Chad,

I have now run our entire darkpan test suite with the version of Test::Simple above. It takes around 3 hours to run :-( and tests 3 APIs (one of which is very large) using JSON sent over various transports (including HTTP). I found no differences from the the previous (and much older) version.

Our test suite uses, Test::More, Test::Deep, Test::Group and Test::Builder. The only thing we did I was unsure would work was overriding Test::Builder::ok and Test::Builder::BAIL_OUT as follows:

     if ($self->{verbose}) {
         Test::Group->verbose($args{verbose}); # so we can see the subtests run:
         # Part copied from
         # http://www.nntp.perl.org/group/perl.qa/2009/05/msg12229.html
         # add call frame to ok's if verbose running
         my $ok = \&Test::Builder::ok;
         #no warnings 'redefined';
         *Test::Builder::ok = sub {
             my ($package, $filename, $line);
             my $frame = 0;
             my $frames = '';
             for (;;) {
                 ( $package, $filename, $line ) = caller($frame);
                 last if !defined $package;
                 $frame++;
                 next if $filename =~ /^\/usr/;
                 $frames .= "$package:$line, ";
             }
             $_[0]->diag("ok, $frames") if $frames;
             goto $ok;
         };

     # redefine the BAIL_OUT method to show call stack:
     {
         my $bail_out = \&Test::Builder::BAIL_OUT;
         *Test::Builder::BAIL_OUT = sub {
             my ($package, $filename, $line);
             my $frame = 0;
             my $frames = '';
             for (;;) {
                 ( $package, $filename, $line ) = caller($frame);
                 last if !defined $package;
                 $frame++;
                 #next if $filename =~ /^\/usr/;
                 $frames .= "$package:$filename:$line, ";
             }
             $_[1] = "$_[1] - $frames";
             goto $bail_out;
         };
     }

but that did not seem to cause a problem.

I hope this gives you some further confidence.

Martin

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About