WTF: $Test::Builder::Level is invalid

Someone started using Test::Pretty and now I can't run tests. I get:

GraphViz2::Marpa: Start ... # $Test::Builder::Level is invalid. Testing library you are using is broken. : 2 at /home/ron/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Test/Version.pm line 134.

Googling didn't help.

I've run cpanm on a range of modules:
o Test::Pretty
o Test::More
o Test::Version
o Test::Exception
o TryCatch

Any ideas?

6 Comments

You already tried hard to locate or isolate the problem?

What exactly are you doing?

Test::Pretty also exists as App::Prove::Plugin, thus can come via prove (.proverc, ENV, -Pretty ...).

Not sure if that applies, but at least it looks suspiciously.

Just saw [2] and [1] (which has to do with $Test::Builder::Level).

[2] says: "CPAN test modules might — in their own tests — be looking for specific output and start breaking. Such tests are inherently fragile, and should be changed to use a TAP parser instead of parsing literal text, but in the meantime, if your favorite test class fails its tests, this Test::More change might be the reason."

[1] https://github.com/Test-More/test-more/pull/396/files

[2] http://www.dagolden.com/index.php/2374/the-next-testmore-might-break-fragile-test-modules/

It's Test::Pretty with Test::Version in combination which is broken.

This is reproducable.

Who is the someone using Test::Pretty? Ron, how are you starting your tests?


For each of my 8 modules which use Marpa::R2, I do:

local $CWD = $dir_name;
($stdout, $stderr) = capture{system 'prove', 't'};

Then I parse the output with:

if ($line =~ /^Files=.+Tests=(\d+),/)

Looking for a line like:

Files=3, Tests=88, 2 wallclock secs ( 0.04 usr 0.02 sys + 2.15 cusr 0.04 csys = 2.25 CPU)

Please for the love of all kittens, use Test::Harness to run your tests and
then ask it for the result, rather than manually parsing the text output.

Leave a comment

About Ron Savage

user-pic I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...