perl.qa http://www.nntp.perl.org/group/perl.qa/ ... Copyright 1998-2012 perl.org Wed, 16 May 2012 19:34:06 +0000 ask@perl.org Re: Tagging tests by Daniel Perrett Thanks, I&#39;ll look into both!<br/><br/>Daniel<br/><br/>On 1 May 2012 19:17, Lars D&#x26A;&#x1D07;&#x1D04;&#x1D0B;&#x1D0F;&#x1D21; &#x8FEA;&#x62C9;&#x65AF; &lt;daxim@cpan.org&gt; wrote:<br/>&gt;&gt; Is there any way to &#39;tag&#39; tests in Perl?<br/>&gt; &lt;http://p3rl.org/Test::Less&gt;<br/>&gt;<br/>&gt;&gt; - If there are common problems (computer can&#39;t access the net, unicode<br/>&gt;&gt; handling is dodgy), this makes it more straightforward to diagnose<br/>&gt;&gt; than reading through logs of very long test scripts with lots of<br/>&gt;&gt; failure diagnostics<br/>&gt; &lt;http://analysis.cpantesters.org/&gt;<br/> http://www.nntp.perl.org/group/perl.qa/2012/05/msg13183.html Tue, 01 May 2012 11:58:04 +0000 Re: Tagging tests by Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 &gt; Is there any way to &#39;tag&#39; tests in Perl?<br/>&lt;http://p3rl.org/Test::Less&gt;<br/><br/>&gt; - If there are common problems (computer can&#39;t access the net, unicode<br/>&gt; handling is dodgy), this makes it more straightforward to diagnose<br/>&gt; than reading through logs of very long test scripts with lots of<br/>&gt; failure diagnostics<br/>&lt;http://analysis.cpantesters.org/&gt;<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/05/msg13182.html Tue, 01 May 2012 11:17:33 +0000 Re: Devel::Cover problem: getting analysis of .xs file but not of.pmfile by James E Keenan On 4/25/12 9:08 PM, James E Keenan wrote:<br/>&gt; Friends,<br/>&gt;<br/>&gt;<br/>&gt; Can anyone advise as to why I am getting coverage analysis of Util.xs<br/>&gt; but not of lib/Hash/Util.pm?<br/>&gt;<br/><br/>Locking %ENV frustrates Devel::Cover.<br/><br/>Starting at approximately line 172 of t/Util.t, we have a test which, <br/>after I&#39;ve reformatted a few lines, looks like this:<br/><br/>lock_keys(%ENV);<br/>eval { () = $ENV{I_DONT_EXIST} };<br/>like(<br/> $@,<br/> qr/^Attempt to access disallowed key &#39;I_DONT_EXIST&#39; in a restricted <br/>hash/,<br/> &#39;locked %ENV&#39;<br/>);<br/><br/>I commented out all the tests in Util.t, then worked my way through <br/>un-commenting them and making sure that all tests still passed. Until I <br/>got to the test above, I got favorable results calling:<br/><br/> prove -vb t/Util.t<br/> cover -delete; harness; cover -summary<br/><br/>... where &#39;harness&#39; simply calls:<br/><br/> HARNESS_PERL_SWITCHES=-MDevel::Cover make test<br/><br/>... and &quot;favorable results&quot; means something like this:<br/><br/>---------------------- ------ ------ ------ ------ ------ ------ ------<br/>File stmt bran cond sub pod time total<br/>---------------------- ------ ------ ------ ------ ------ ------ ------<br/>Util.xs 88.2 58.3 n/a n/a n/a n/a 70.7<br/>blib/lib/Hash/Util.pm 82.9 59.1 11.1 87.5 92.0 100.0 78.8<br/>Total 83.6 58.7 11.1 87.5 92.0 100.0 77.4<br/>---------------------- ------ ------ ------ ------ ------ ------ ------<br/><br/>But when I extended the uncommented lines to include the &#39;like&#39; after <br/>lock_keys(%ENV), &#39;prove&#39; still PASSed all tests but the line for <br/>&#39;blib/lib/Hash/Util.pm&#39; vanished.<br/><br/>When I kept the lock_keys lines commented out, but uncommented the <br/>balance of the file, both prove and cover DWIMmed.<br/><br/>Hence, these few lines were the cause of the problem. So now this <br/>becomes an obscure bug in Devel::Cover: Why does lock_keys(%ENV) cause <br/>reporting on a package to vanish -- but not affect the reporting on the <br/>XS file?<br/><br/>I&#39;ll leave that for others (read: pjcj) to ponder. In the meantime, I <br/>hope to add tests to shore up the surprisingly poor coverage of <br/>Hash::Util by its test file.<br/><br/>Thank you very much.<br/>Jim Keenan<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13181.html Thu, 26 Apr 2012 17:54:09 +0000 Test::Builder 1.5.0 alpha 5 released by Michael G Schwern The fifth alpha for Test::Builder 1.5 has been released. It contains work<br/>from Matthew Horsfall, Peter Rabbitson, geistteufel, Karen Etheridge, Michael<br/>Schwern and others.<br/><br/>It primarily addresses threading issues and regressions discovered via testing<br/>CPAN modules.<br/><br/>https://metacpan.org/release/MSCHWERN/Test-Simple-1.005000_005/<br/>https://github.com/schwern/test-more/<br/><br/>Please report any bugs or regressions in your CPAN modules at<br/>https://github.com/schwern/test-more/issues<br/>We very much want to hear about broken CPAN modules, CPAN is a very good test<br/>suite.<br/><br/>Smokers, please load your alpha smokers with this new version.<br/><br/><br/>1.005000_005 Thu Apr 26 15:23:25 PDT 2012<br/> New Features<br/> * cmp_ok() will error when used with something which is not a<br/> comparison operator, including =, += and the like.<br/> [github 141]<br/><br/> Bug Fixes<br/> * Using a reference as a test name works again. [github #264]<br/> * Protected against Test::More accidentally overwriting $!<br/> [github #268] [github #266]<br/> * Restored the behavior of a fork, it will not issue its own<br/> plan, making testing with fork easier.<br/> * Test::Builder-&gt;name() has been restored. [github #220]<br/> (Matthew Horsfall)<br/> * TB2::BlackHole no longer tries to AUTOLOAD its destructor.<br/> [github #280] (Peter Rabbitson)<br/> * Threads work on 5.12 and 5.10 again. (Peter Rabbitson)<br/><br/> Doc Fixes<br/> * use_ok() has been discouraged and de-emphasized as a general<br/> replacement for `use` in tests. [github #288]<br/><br/> Incompatible Changes with previous alphas<br/> * TB2::Counter has been removed [github 119]<br/> * The test counter has been moved from the TAP formatter<br/> into TB2::History [github 190]<br/> * TB2::TestState is no longer a complete subclass of<br/> TB2::EventCoordinator, but delegates most EC methods. The isa/can<br/> trickery caused threading issues. [github 291]<br/> * TB2::TestState-&gt;current_coordinator is now TB2::TestState-&gt;ec.<br/> * use_ok() will no longer apply lexical pragams. The incompatibilities<br/> and extra complexity is not worth the marginal use.<br/> [github #287]<br/><br/><br/>1.005000_004 Sun Mar 25 15:01:49 BST 2012<br/> Bug Fixes<br/> * Fix the thread crashes occurring with 5.12 and down.<br/> [github 261]<br/><br/> Test Fixes<br/> * t/History/child_process.t was failing, the forked processes were<br/> improperly coordinated.<br/><br/> Incompatible Changes with previous alphas<br/> * coordinate_threads() has been removed. It had no use case and was<br/> complicating threads which are quite complicated enough thank you.<br/><br/><br/>-- <br/>31. Not allowed to let sock puppets take responsibility for any of my<br/> actions.<br/> -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army<br/> http://skippyslist.com/list/<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13180.html Thu, 26 Apr 2012 15:46:28 +0000 Devel::Cover problem: getting analysis of .xs file but not of .pmfile by James E Keenan Friends,<br/><br/>As an extension of my work on <br/>https://rt.perl.org/rt3/Ticket/Display.html?id=112126, I am trying to <br/>measure the test coverage for Perl 5 core distribution Hash-Util <br/>provided by the Perl 5 test suite. For ease of development, I have <br/>copied ext/Hash-Util/lib/Hash/Util.pm and ext/Hash-Util/t/Util.t into a <br/>typical CPAN distribution setup. I have applied the patches submitted <br/>in RT #112126 and modified t/Util.t to remove all the setup needed to <br/>run it as part of the Perl 5 test suite and instead run it as if it were <br/>a part of a regular CPAN distribution.<br/><br/>So I&#39;m now at a point where I want to perform coverage analysis. <br/>However, try as I might, I cannot get a report of the test coverage of <br/>lib/Hash/Util.pm I want -- and this having used Devel::Cover for nine years!<br/><br/>Please see the attachment in which I show the output of:<br/><br/>perl Makefile.PL &amp;&amp; make &amp;&amp; cover -test<br/><br/>Note that I *am* getting coverage output for Util.xs, but I&#39;m *not* <br/>getting coverage for lib/Hash/Util.pm. This is most puzzling.<br/><br/>I have Devel::Cover version 0.80 installed and am running this with Perl <br/>5.14.2.<br/><br/>To facilitate getting assistance with this, I have push my <br/>quasi-distribution to Github:<br/><br/>https://github.com/jkeenan/Hash-Util<br/><br/>Can anyone advise as to why I am getting coverage analysis of Util.xs <br/>but not of lib/Hash/Util.pm?<br/><br/>Thank you very much.<br/>Jim Keenan<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13179.html Wed, 25 Apr 2012 18:08:18 +0000 Re: Tagging tests by Greg Sabino Mullane On Tue, Apr 24, 2012 at 07:09:19PM +0100, Daniel Perrett wrote:<br/>&gt; Is there any way to &#39;tag&#39; tests in Perl?<br/><br/>Not that I can think of, in the way that you want.<br/><br/>&gt; It looks likely that even though all the search tests fail, they are<br/>&gt; failing because there is no working connection, as tested by the first<br/>&gt; http request. Although five of the unicode tests are failing, three<br/>&gt; aren&#39;t (throwing unicode characters at the syntax).<br/><br/>Seems to me the easiest way to handle that is to have simple tests <br/>at the start of your chain that BAIL OUT if they see a major problem.<br/>While the unicode wouldn&#39;t be in that solution, I can&#39;t see how the <br/>complexity of adding tags would prevent a user from having to manually <br/>look at the failing tests anyway.<br/><br/>&gt; (I guess one answer could be &#39;write them in separate test scripts&#39; but<br/>&gt; what I want is tags (many-to-many) rather than categories<br/>&gt; (many-to-one), and more files is a bit cumbersome.)<br/><br/>Perhaps you can give a more convincing/real-world test case where <br/>this would be needed? I would think that a single early test catching <br/>many known major failures would be the way to go. If there was something, <br/>such as unicode, which warranted tags, I&#39;m not sure why it wouldn&#39;t warrant <br/>it&#39;s own group of tests. Tests are the one are where I never worry about <br/>overlap, efficiency, or having too many files. :)<br/><br/>-- <br/>Greg Sabino Mullane greg@endpoint.com<br/>End Point Corporation<br/>PGP Key: 0x14964AC8<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13178.html Wed, 25 Apr 2012 11:45:17 +0000 Tagging tests by Daniel Perrett Is there any way to &#39;tag&#39; tests in Perl?<br/><br/>What I mean is, that ideally, if you tagged all your tests according<br/>to the functionality they depended on, you could use the tags to more<br/>easily work out what was going wrong.<br/><br/># Looks like you failed 21 tests of 75.<br/># Failures by tag:<br/># syntax: 0/50<br/># lwp: 21/25<br/># http: 21/21<br/># search: 20/20<br/># unicode: 5/8<br/><br/>This report is for some hypothetical module which imports some syntax<br/>and allows the user to run some searches over the web via an LWP<br/>object.<br/><br/>Here, we can see at a glance that there is nothing wrong with the<br/>syntactic code, and the code which requires LWP itself is probably<br/>fine because the problem only comes when the user tries to make http<br/>requests.<br/><br/>It looks likely that even though all the search tests fail, they are<br/>failing because there is no working connection, as tested by the first<br/>http request. Although five of the unicode tests are failing, three<br/>aren&#39;t (throwing unicode characters at the syntax).<br/><br/>Assuming there isn&#39;t any way to &#39;tag&#39; tests, like this, should there<br/>be? The problems I can see are:<br/><br/>- How to make it easy to do syntactially, avoiding lots of repetition<br/>- Whether this requires a complete rewrite of the assumptions of the<br/>core test handling modules<br/>- The effort involved for test authors in tagging tests in this detail<br/>- Some test failures happen something unexpected went wrong, and<br/>tagging is only useful if we know what categories are useful.<br/>- It could encourage authors to be lazy<br/><br/>But the advantages are<br/><br/>- If there are common problems (computer can&#39;t access the net, unicode<br/>handling is dodgy), this makes it more straightforward to diagnose<br/>than reading through logs of very long test scripts with lots of<br/>failure diagnostics<br/>- Might be useful for coverage checking (you could write something<br/>asking if you have a test which has a particular combination of tags)<br/>- You can write more clever algorithms to try to pinpoint where the<br/>problem is (e.g. which combinations of tags always fail)<br/>- Makes TDD easier because you can write lots of tests which will fail<br/>(and you know you can ignore because they depend on code that isn&#39;t<br/>written yet), and you can still focus on the features you&#39;re writing<br/>right now.<br/><br/>(I guess one answer could be &#39;write them in separate test scripts&#39; but<br/>what I want is tags (many-to-many) rather than categories<br/>(many-to-one), and more files is a bit cumbersome.)<br/><br/>Daniel<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13177.html Tue, 24 Apr 2012 11:09:31 +0000 Re: Testing Output and Functionality by Jed Lund Eirik,<br/><br/>Thank you for the suggestion. I had not seen Test::Trap in my searches so<br/>I will investigate.<br/><br/>Best Regards,<br/><br/>Jed<br/><br/>On Mon, Apr 23, 2012 at 11:44 PM, Eirik Berg Hanssen &lt;<br/>Eirik-Berg.Hanssen@allverden.no&gt; wrote:<br/><br/>&gt; On Tue, Apr 24, 2012 at 6:35 AM, Jed Lund &lt;jandrewlund@gmail.com&gt; wrote:<br/>&gt;<br/>&gt;&gt; Hello,<br/>&gt;&gt;<br/>&gt;&gt; I was wondering if I could get some pointers towards a module or package<br/>&gt;&gt; that would allow me to test the functionality of various elements of code<br/>&gt;&gt; that I was developing while I also tested the STDERR and STDOUT output<br/>&gt;&gt; from<br/>&gt;&gt; that element of code? I have been hunting around CPAN for the right fit<br/>&gt;&gt; but so far I have only found STDERR/STDOUT tests or functionality tests<br/>&gt;&gt; not<br/>&gt;&gt; a way to test both results from the same method call.<br/>&gt;&gt;<br/>&gt;<br/>&gt; This sounds like a job for ... Test::Trap!<br/>&gt;<br/>&gt;<br/>&gt; The most basic case would be to test the output of a method that returned<br/>&gt;&gt; some defined result while also capturing any warnings prompted by<br/>&gt;&gt; malformed<br/>&gt;&gt; input which did not cause catastrophic failure. The goal would be to<br/>&gt;&gt; certify the output and the warning message from the same method call.<br/>&gt;&gt;<br/>&gt;<br/>&gt;<br/>&gt; my $result = trap { $obj-&gt;method(@args) }; # or my @results, for list<br/>&gt; context<br/>&gt; # Possibly:<br/>&gt; $trap-&gt;warn_is_deeply( \@expected_warnings, &quot;Got exactly the expected<br/>&gt; warnings?&quot; );<br/>&gt; # ... but usually more usefully:<br/>&gt; $trap-&gt;stderr_like( $pattern, &quot;Trapped stderr matches expectations&quot; );<br/>&gt; # ... and you may still test $trap-&gt;stdout, $result/@result (or<br/>&gt; $trap-&gt;return), and whatever else, from the same call.<br/>&gt;<br/>&gt;<br/>&gt; Eirik<br/>&gt;<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13176.html Tue, 24 Apr 2012 09:28:05 +0000 Re: Testing Output and Functionality by Jed Lund David,<br/><br/>Thank you for your suggestion. I haven&#39;t gone down that road yet so I will<br/>try it.<br/><br/>Best Regards,<br/><br/>Jed<br/><br/>On Tue, Apr 24, 2012 at 4:07 AM, David Golden &lt;xdaveg@gmail.com&gt; wrote:<br/><br/>&gt; On Tue, Apr 24, 2012 at 12:35 AM, Jed Lund &lt;jandrewlund@gmail.com&gt; wrote:<br/>&gt; &gt; I understand that this is a fairly basic question but I am stuck trying<br/>&gt; to<br/>&gt; &gt; find the right path forward.<br/>&gt;<br/>&gt; It&#39;s not entirely basic, because you&#39;re testing an array of three<br/>&gt; &quot;outputs&quot; for each functionality test instead of just one.<br/>&gt;<br/>&gt; I&#39;d probably use Capture::Tiny:<br/>&gt;<br/>&gt; use Capture::Tiny qw/capture/;<br/>&gt;<br/>&gt; my ($out, $err, $result) = capture { your_code_here };<br/>&gt; # then test $out, $err, $result however you want<br/>&gt;<br/>&gt; If that&#39;s repetitive, stick it in a loop or write a function to<br/>&gt; abstract testing the three results against your expectations.<br/>&gt;<br/>&gt; -- David<br/>&gt;<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13175.html Tue, 24 Apr 2012 09:28:03 +0000 Re: Testing Output and Functionality by David Golden On Tue, Apr 24, 2012 at 12:35 AM, Jed Lund &lt;jandrewlund@gmail.com&gt; wrote:<br/>&gt; I understand that this is a fairly basic question but I am stuck trying to<br/>&gt; find the right path forward.<br/><br/>It&#39;s not entirely basic, because you&#39;re testing an array of three<br/>&quot;outputs&quot; for each functionality test instead of just one.<br/><br/>I&#39;d probably use Capture::Tiny:<br/><br/> use Capture::Tiny qw/capture/;<br/><br/> my ($out, $err, $result) = capture { your_code_here };<br/> # then test $out, $err, $result however you want<br/><br/>If that&#39;s repetitive, stick it in a loop or write a function to<br/>abstract testing the three results against your expectations.<br/><br/>-- David<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13174.html Tue, 24 Apr 2012 04:08:26 +0000 Re: Testing Output and Functionality by Eirik Berg Hanssen On Tue, Apr 24, 2012 at 6:35 AM, Jed Lund &lt;jandrewlund@gmail.com&gt; wrote:<br/><br/>&gt; Hello,<br/>&gt;<br/>&gt; I was wondering if I could get some pointers towards a module or package<br/>&gt; that would allow me to test the functionality of various elements of code<br/>&gt; that I was developing while I also tested the STDERR and STDOUT output from<br/>&gt; that element of code? I have been hunting around CPAN for the right fit<br/>&gt; but so far I have only found STDERR/STDOUT tests or functionality tests not<br/>&gt; a way to test both results from the same method call.<br/>&gt;<br/><br/> This sounds like a job for ... Test::Trap!<br/><br/><br/>The most basic case would be to test the output of a method that returned<br/>&gt; some defined result while also capturing any warnings prompted by malformed<br/>&gt; input which did not cause catastrophic failure. The goal would be to<br/>&gt; certify the output and the warning message from the same method call.<br/>&gt;<br/><br/><br/>my $result = trap { $obj-&gt;method(@args) }; # or my @results, for list<br/>context<br/># Possibly:<br/>$trap-&gt;warn_is_deeply( \@expected_warnings, &quot;Got exactly the expected<br/>warnings?&quot; );<br/># ... but usually more usefully:<br/>$trap-&gt;stderr_like( $pattern, &quot;Trapped stderr matches expectations&quot; );<br/># ... and you may still test $trap-&gt;stdout, $result/@result (or<br/>$trap-&gt;return), and whatever else, from the same call.<br/><br/><br/>Eirik<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13173.html Tue, 24 Apr 2012 01:01:47 +0000 Re: Testing Output and Functionality by Jed Lund Andy,<br/><br/>Thank you for the reply.<br/><br/>I did try Test::Output but I ran into a Smart::Comments incompatibility.<br/> This is a sort of corner case to the issue I described where I am trying<br/>to print the Smart::Comments but capture the STDOUT output for testing.<br/> When I run the following;<br/><br/>use Test::Most;<br/>use Test::Output;<br/>use Smart::Comments &#39;###&#39;;<br/>stdout_is( sub{<br/> print &quot;Hello World\n&quot;;<br/> ### Goodby World ...<br/>}, &quot;Hello World\n&quot;, &#39;Test Hello World&#39; );<br/>done_testing();<br/><br/>I get the following error;<br/><br/>Can&#39;t locate object method &quot;TELL&quot; via package &quot;Test::Output::Tie&quot; at<br/>C:/Perl/site/lib/Smart/Comments.pm line 438.<br/><br/>While a warn or carp statement in the same place seems to work just fine<br/>the Smart::Comments don&#39;t. I kind of walked away at that point and started<br/>looking somewhere else. Should I just be more persistent to fix this issue<br/>or is there another solution?<br/><br/>Best Regards,<br/><br/>Jed<br/><br/>On Mon, Apr 23, 2012 at 9:53 PM, Andy Lester &lt;andy@petdance.com&gt; wrote:<br/><br/>&gt;<br/>&gt; On Apr 23, 2012, at 11:35 PM, Jed Lund wrote:<br/>&gt;<br/>&gt; that element of code? I have been hunting around CPAN for the right fit<br/>&gt; but so far I have only found STDERR/STDOUT tests or functionality tests not<br/>&gt; a way to test both results from the same method call.<br/>&gt;<br/>&gt;<br/>&gt; Sounds like you&#39;re looking for Test::Output.<br/>&gt;<br/>&gt; http://search.cpan.org/dist/Test-Output/<br/>&gt;<br/>&gt; xoxo,<br/>&gt; Andy<br/>&gt;<br/>&gt; --<br/>&gt; Andy Lester =&gt; andy@petdance.com =&gt; www.petdance.com =&gt; AIM:petdance<br/>&gt;<br/>&gt;<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13172.html Tue, 24 Apr 2012 01:01:46 +0000 Re: Testing Output and Functionality by Andy Lester <br/>On Apr 23, 2012, at 11:35 PM, Jed Lund wrote:<br/><br/>&gt; that element of code? I have been hunting around CPAN for the right fit<br/>&gt; but so far I have only found STDERR/STDOUT tests or functionality tests not<br/>&gt; a way to test both results from the same method call.<br/><br/><br/>Sounds like you&#39;re looking for Test::Output.<br/><br/>http://search.cpan.org/dist/Test-Output/<br/><br/>xoxo,<br/>Andy<br/><br/>--<br/>Andy Lester =&gt; andy@petdance.com =&gt; www.petdance.com =&gt; AIM:petdance<br/><br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13171.html Mon, 23 Apr 2012 21:53:19 +0000 Testing Output and Functionality by Jed Lund Hello,<br/><br/>I was wondering if I could get some pointers towards a module or package<br/>that would allow me to test the functionality of various elements of code<br/>that I was developing while I also tested the STDERR and STDOUT output from<br/>that element of code? I have been hunting around CPAN for the right fit<br/>but so far I have only found STDERR/STDOUT tests or functionality tests not<br/>a way to test both results from the same method call.<br/><br/>The most basic case would be to test the output of a method that returned<br/>some defined result while also capturing any warnings prompted by malformed<br/>input which did not cause catastrophic failure. The goal would be to<br/>certify the output and the warning message from the same method call.<br/><br/>I understand that this is a fairly basic question but I am stuck trying to<br/>find the right path forward.<br/><br/>Best Regards,<br/><br/>Jed<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13170.html Mon, 23 Apr 2012 21:43:59 +0000 use_ok tasks by Michael G Schwern I&#39;ve cut three tasks related to the use_ok() discussion, should people be<br/>interested in doing some small work to that end.<br/><br/>Revert use_ok() back to its 0.98 features<br/>https://github.com/schwern/test-more/issues/287<br/><br/>Discourage use_ok() in the docs<br/>https://github.com/schwern/test-more/issues/288<br/><br/>Add test_history() to Test::More to access the History object<br/>(this makes it much easier to bail on fail)<br/>https://github.com/schwern/test-more/issues/286<br/><br/><br/>-- <br/>191. Our Humvees cannot be assembled into a giant battle-robot.<br/> -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army<br/> http://skippyslist.com/list/<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13169.html Mon, 23 Apr 2012 12:34:50 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael G Schwern On 2012.4.14 4:03 AM, Aristotle Pagaltzis wrote:<br/>&gt;&gt; Which is a bit of a mouthful. Providing a function to get at the<br/>&gt;&gt; history object would make a bunch of test state introspection easier.<br/>&gt;&gt;<br/>&gt;&gt; # That looks pretty good.<br/>&gt;&gt; END { BAIL_OUT() unless test_history-&gt;test_was_successful }<br/>&gt; <br/>&gt; I like that.<br/><br/>Go at it.<br/>https://github.com/schwern/test-more/issues/286<br/><br/><br/>-- <br/>package Outer::Space; use Test::More tests =&gt; 9;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13168.html Mon, 23 Apr 2012 11:33:37 +0000 Re: Thanks for supporting the Perl QA Hackathon 2012 by L Boivin Hello.<br/><br/>I am ashamed.<br/>I forgot some sponsors.<br/>I&#39;ve no excuse.<br/><br/>As Community sponsor, I want also thank :<br/>Stiching Perl Promotie Nederland - http://www.sppn.nl/<br/><br/>We had also in-kind donations: some companies and organizations<br/>sponsored directly some of our attendees, paying for their travel<br/>fees and accomodation:<br/>Procura - http://procura.nl/<br/>Booking.com - http://www.booking.com/<br/>Dyn - http://www.dyn.com/<br/>Dijkmat - http://www.dijkmat.nl/<br/>Shadowcat Systems - http://www.shadow.cat/<br/>The Perl Foundation - http://www.perlfoundation.org/<br/><br/><br/>Many thanks for your help.<br/><br/>Many thanks to all the attendees too, for the job done!<br/><br/>Kind Regards<br/>Laurent, ashamed<br/><br/><br/>On 15/04/2012 18:13, L Boivin wrote:<br/>&gt; Hello,<br/>&gt; <br/>&gt; The Perl QA Hackathon 2012 is now over. The event took place 2 weeks<br/>&gt; ago, for three days, and was well received by the attendees both on<br/>&gt; the technical side (having all of them in the same location) and on<br/>&gt; the social and logistical side (thanks to your support).<br/>&gt; <br/>&gt; In the end, 40 people from 11 countries attended the hackathon. These<br/>&gt; people are well-known in the Perl community for their interest in and<br/>&gt; their knowledge of Perl, Quality Assurance and the CPAN toolchain.<br/>&gt; They spent three days together in Paris, in the &quot;Carrefour Num&eacute;rique&quot;<br/>&gt; of &quot;La Cit&eacute; des Sciences et de l&#39;Industrie-Universcience&quot;, debugging,<br/>&gt; improving, creating processes, tools, test environments for the good<br/>&gt; of the Perl community.<br/>&gt; <br/>&gt; The results of the week-end are listed on the hackathon website:<br/>&gt; http://2012.qa-hackathon.org/qa2012/wiki?node=Results<br/>&gt; <br/>&gt; Such results would never have been possible without the logistical<br/>&gt; support provided to our hackers. We would never have been able to<br/>&gt; provide it without you, our sponsors for the Perl QA Hackathon 2012.<br/>&gt; <br/>&gt; On behalf of the Perl community, I would like to thank you for your support.<br/>&gt; <br/>&gt; The money collected has been spent on travel (32%) and hotel (20%)<br/>&gt; refunds for some attendees, catering (34%) and bank fees. The<br/>&gt; surplus (10 %) will be donated to the organizers of the Perl<br/>&gt; QA Hackathon 2013, which will be held in London. The final budget<br/>&gt; will be available in a few days on the hackathon website.<br/>&gt; <br/>&gt; Among the wiki pages added at the end of the week-end, a page<br/>&gt; collecting blog posts has been started:<br/>&gt; http://2012.qa-hackathon.org/qa2012/wiki?node=Blogs<br/>&gt; It collects links to blog posts that talk about the event.<br/>&gt; <br/>&gt; Once again, the Perl QA Hackathon 2012 participants and organizers,<br/>&gt; as well as the Perl community as a whole, would like to thank for<br/>&gt; the support you have provided to this event.<br/>&gt; <br/>&gt; Our partner::<br/>&gt; Le Carrefour Num&eacute;rique - http://www.cite-sciences.fr/<br/>&gt; <br/>&gt; Our &quot;corporate&quot; sponsors:<br/>&gt; diabolocom - http://www.diabolocom.com/<br/>&gt; Dijkmat - http://www.dijkmat.nl/<br/>&gt; DuckDuckGo - http://www.duckduckgo.com/<br/>&gt; Dyn - http://www.dyn.com/<br/>&gt; Feeside - http://freeside.biz/<br/>&gt; Hedera Technology - http://www.hederatech.com/<br/>&gt; Jaguar Network - http://www.jaguar-network.com/<br/>&gt; Shadowcat Systems - http://www.shadow.cat<br/>&gt; Splio - http://www.splio.com/<br/>&gt; TECLIB&#39; - http://www.teclib.com/<br/>&gt; weborama - http://weborama.com/<br/>&gt; <br/>&gt; Nos &quot;Community&quot; sponsors:<br/>&gt; EPO - http://www.enlightenedperl.org/<br/>&gt; $foo Magazin - http://www.perl-magazin.de/<br/>&gt; Les Mongueurs de Perl - http://www.mongueurs.net/<br/>&gt; <br/>&gt; Our donators:<br/>&gt; Martin Evans<br/>&gt; Mark Keating<br/>&gt; Prakash Kailasa<br/>&gt; Neil Bowers<br/>&gt; &#x52A0;&#x85E4; &#x6566; (Ktat)<br/>&gt; Karen Pauley<br/>&gt; Chad Davis<br/>&gt; Franck Cuny<br/>&gt; &#x8FD1;&#x85E4;&#x5609;&#x96EA;<br/>&gt; Tomohiro Hosaka<br/>&gt; Syohei Yoshida<br/>&gt; &#x7267; &#x5927;&#x8F14; (lestrrat)<br/>&gt; <br/>&gt; <br/>&gt; A big thank to all of you!<br/>&gt; <br/>&gt; Kind Regards<br/>&gt; Laurent Boivin<br/>&gt; Philippe Bruhat<br/>&gt; for the Perl QA Hackathon 2012<br/>&gt; <br/>&gt; <br/><br/><br/>-- <br/>Laurent Boivin -- mailto:l.boivin@free.fr<br/>Member of Grenoble.pm, Paris.pm<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13167.html Sat, 21 Apr 2012 10:56:46 +0000 [PQAH2012] Financial Report -- final by L Boivin Hello,<br/><br/>This is the financial report of the Perl QA Hackathon 2012.<br/>It was a nice exercise of accountancy :-)<br/><br/>I&#39;m happy to announce that the Perl QA Hackathon 2013 will start<br/>with &euro; 1495.66, let me know when/how you want it.<br/><br/>If you&#39;re interested in the details, here&#39;s the spreadsheet<br/>I used (LibreOffice), with details and explantions:<br/>http://dl.dropbox.com/u/44168013/PQAH2012_financial_report.ods<br/><br/>I&#39;ve also updated the Budget page on the web site.<br/>It&#39;ll appear at the next synchro (at midnight, CEST).<br/>Preview on the test website (http://test.mongueurs.net/qa2012/budget.html)<br/><br/>Kind Regards<br/>Laurent<br/>-- <br/>Laurent Boivin -- mailto:l.boivin@free.fr<br/>Member of Grenoble.pm, Paris.pm<br/><br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13166.html Sat, 21 Apr 2012 10:49:17 +0000 Re: Revert use_ok() change to allow lexical effects? by Aristotle Pagaltzis Hi Michael,<br/><br/>* Michael G Schwern &lt;schwern@pobox.com&gt; [2012-04-13 04:00]:<br/>&gt; On 2012.4.11 1:01 PM, Aristotle Pagaltzis wrote:<br/>&gt; &gt;&gt;Unless I&#39;m mistaken, Test::AutoBailOut is doing to need a global<br/>&gt; &gt;&gt;$SIG{__DIE__} handler or override CORE::require or add something to<br/>&gt; &gt;&gt;@INC or try to parse exception messages or something like that. Any<br/>&gt; &gt;&gt;of those have global side effects which can potentially interfere with<br/>&gt; &gt;&gt;or be overwritten by the code being tested.<br/>&gt; &gt;<br/>&gt; &gt;&hellip; what for? Is Ovid&rsquo;s solution of just using an END block insufficient?<br/>&gt; &gt;Why?<br/>&gt;<br/>&gt; You&#39;re referring to this?<br/>&gt; http://www.nntp.perl.org/group/perl.qa/2012/04/msg13128.html<br/><br/>yes.<br/><br/>&gt; If all you want is to bail out if the test fails to complete, that&#39;s<br/>&gt; easy(er).<br/><br/>That&rsquo;s all AutoBailout does, it is just Ovid&rsquo;s code packaged up as<br/>a tiny module. That is why I suggested shipping it with Test::More.<br/>I cannot imagine it ever causing a burden (though I&rsquo;m fine with shipping<br/>it separately too). Just because it does so little, bordering on nothing.<br/><br/>&gt; I thought it was going to do something specifically when a `use`<br/>&gt; fails, thus all the complexity.<br/><br/>Well, does it need to? Test reports will contain STDERR anyway. All you<br/>lose is that the error message is a bit more raw.<br/><br/>&gt; A general &quot;bail out if this test file fails&quot; function might be handy.<br/>&gt; An even more general &quot;do X if the test finishes in Y state&quot; would be<br/>&gt; even more handy.<br/>&gt;<br/>&gt; # There is no test_passed()<br/>&gt; END { BAIL_OUT() unless test_passed(); }<br/>&gt;<br/>&gt; I don&#39;t want to add a huge bunch of functions to Test::More to cover<br/>&gt; all the possible test states, in 1.5 you can get them from the<br/>&gt; TB2::History object.<br/>&gt;<br/>&gt; # This works in TB 1.5<br/>&gt; END { BAIL_OUT() unless Test::More-&gt;builder-&gt;history-&gt;test_was_successful }<br/>&gt;<br/>&gt; Which is a bit of a mouthful. Providing a function to get at the<br/>&gt; history object would make a bunch of test state introspection easier.<br/>&gt;<br/>&gt; # That looks pretty good.<br/>&gt; END { BAIL_OUT() unless test_history-&gt;test_was_successful }<br/><br/>I like that.<br/><br/>Regards,<br/>-- <br/>Aristotle Pagaltzis // &lt;http://plasmasturm.org/&gt;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13165.html Sat, 14 Apr 2012 01:03:12 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael G Schwern On 2012.4.11 1:01 PM, Aristotle Pagaltzis wrote:<br/>&gt;&gt; Unless I&#39;m mistaken, Test::AutoBailOut is doing to need a global<br/>&gt;&gt; $SIG{__DIE__} handler or override CORE::require or add something to<br/>&gt;&gt; @INC or try to parse exception messages or something like that. Any<br/>&gt;&gt; of those have global side effects which can potentially interfere with<br/>&gt;&gt; or be overwritten by the code being tested.<br/>&gt; <br/>&gt; &hellip; what for? Is Ovid&rsquo;s solution of just using an END block insufficient?<br/>&gt; Why?<br/><br/>You&#39;re referring to this?<br/>http://www.nntp.perl.org/group/perl.qa/2012/04/msg13128.html<br/><br/>If all you want is to bail out if the test fails to complete, that&#39;s easy(er).<br/> I thought it was going to do something specifically when a `use` fails, thus<br/>all the complexity.<br/><br/>A general &quot;bail out if this test file fails&quot; function might be handy. An even<br/>more general &quot;do X if the test finishes in Y state&quot; would be even more handy.<br/><br/> # There is no test_passed()<br/> END { BAIL_OUT() unless test_passed(); }<br/><br/>I don&#39;t want to add a huge bunch of functions to Test::More to cover all the<br/>possible test states, in 1.5 you can get them from the TB2::History object.<br/><br/> # This works in TB 1.5<br/> END { BAIL_OUT() unless Test::More-&gt;builder-&gt;history-&gt;test_was_successful }<br/><br/>Which is a bit of a mouthful. Providing a function to get at the history<br/>object would make a bunch of test state introspection easier.<br/><br/> # That looks pretty good.<br/> END { BAIL_OUT() unless test_history-&gt;test_was_successful }<br/><br/><br/>-- <br/>Look at me talking when there&#39;s science to do.<br/>When I look out there it makes me glad I&#39;m not you.<br/>I&#39;ve experiments to be run.<br/>There is research to be done<br/>On the people who are still alive.<br/> -- Jonathan Coulton, &quot;Still Alive&quot;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13164.html Thu, 12 Apr 2012 18:55:02 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael G Schwern On 2012.4.11 1:45 PM, Andy Lester wrote:<br/>&gt; test_requires is Module::Build only, right? I don&#39;t use Module::Build.<br/><br/>It was just added to ExtUtils::MakeMaker but I don&#39;t know when a stable will<br/>be released.<br/><br/><br/>-- <br/>There will be snacks.<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13163.html Thu, 12 Apr 2012 18:38:06 +0000 Re: Revert use_ok() change to allow lexical effects? by Eirik Berg Hanssen On Wed, Apr 11, 2012 at 6:32 PM, Michael G Schwern &lt;schwern@pobox.com&gt;wrote:<br/><br/>&gt; On 2012.4.10 6:21 PM, The Sidhekin wrote:<br/>&gt; &gt; * How would you rewrite a test script such as my own<br/>&gt; &gt; http://cpansearch.perl.org/src/EBHANSSEN/Test-Trap-v0.2.2/t/00-load.t so<br/>&gt; &gt; that it does not use use_ok()?<br/>&gt;<br/>&gt; use Test::More tests =&gt; 1;<br/>&gt;<br/>&gt; use Test::Trap::Builder::TempFile;<br/>&gt;<br/><br/>*cut*<br/><br/> If this fails, the test script will terminate immediately:<br/><br/>* I won&#39;t get to know if any of the other modules loaded correctly, or how<br/>they fail. Less of the interesting output.<br/>* And there will be no BAIL_OUT, so the rest of the tests will run, burying<br/>the interesting output. More uninteresting output.<br/><br/> Which are two very annoying changes in your rewrite. And of course,<br/>there&#39;s more of the same in the part of the rewrite I cut.<br/><br/><br/><br/><br/>&gt; * Why would you? :-\<br/>&gt;<br/>&gt; Because it reads like normal Perl and doesn&#39;t rely on more code to do<br/>&gt; something rather simple: load a module.<br/>&gt;<br/><br/> But it fails to DWIW: report clearly on failures. Perhaps what it is<br/>doing is not so simple, after all?<br/><br/><br/><br/>&gt; But quite honestly, if use_ok() works for you, if all you need is require +<br/>&gt; import + test, continue to use it. I don&#39;t plan on eliminating it.<br/>&gt;<br/><br/> Thank you.<br/><br/><br/>Eirik<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13162.html Thu, 12 Apr 2012 01:36:45 +0000 Re: 00-load.t tool by Buddy Burden Guys,<br/><br/>&gt; Looking at this a different way, instead of a library, make a distzilla<br/>&gt; extension (or whatever) which generates (and regenerates) a 00-load.t<br/>&gt; as per Ovid&#39;s earlier example.<br/>&gt; :<br/>&gt; :<br/><br/>This sounds like the best idea to me.<br/><br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- Buddy<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13161.html Wed, 11 Apr 2012 18:15:52 +0000 Re: Revert use_ok() change to allow lexical effects? by James E Keenan On 4/11/12 12:33 PM, Michael G Schwern wrote:<br/>&gt;<br/>&gt; Let me reiterate, I have no plans to *deprecate* `use_ok`. Even if I wanted<br/>&gt; to there are simply too many users to make deprecation worth while.<br/>&gt;<br/>&gt; It works fine if what you want is a runtime require + import + assert, and<br/>&gt; sometimes you want that. The problem is it&#39;s been overused and has come to<br/>&gt; replace a simple `use` in test scripts. To that end the question is whether<br/>&gt; to *discourage* its use in the documentation: to scale it back from &quot;use this<br/>&gt; when you load a module&quot; to &quot;use this for some special cases&quot;.<br/>&gt;<br/>&gt;<br/><br/>+1 to discouraging use_ok<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13160.html Wed, 11 Apr 2012 17:01:21 +0000 Re: Revert use_ok() change to allow lexical effects? by Andy Lester <br/>On Apr 11, 2012, at 5:48 PM, Aristotle Pagaltzis wrote:<br/><br/>&gt; The stop energy<br/>&gt; he is throwing at it has no substantive reason so far, only &ldquo;I don&rsquo;t<br/>&gt; care for this&rdquo;.<br/><br/>No, no, no, I&#39;m sorry, I didn&#39;t mean to make it sound like &quot;You shouldn&#39;t do this module.&quot; No stop energy intended. I just wanted to provide a counter viewpoint from a potential customer.<br/><br/>I don&#39;t want to have another module prereq. I&#39;d probably just do the cut &amp; paste into my t/00-load.t. <br/><br/>Carry on!<br/><br/>xoa<br/><br/>--<br/>Andy Lester =&gt; andy@petdance.com =&gt; www.petdance.com =&gt; AIM:petdance<br/><br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13159.html Wed, 11 Apr 2012 16:24:31 +0000 Re: Revert use_ok() change to allow lexical effects? by Aristotle Pagaltzis * Michael Peters &lt;mpeters@plusthree.com&gt; [2012-04-11 23:15]:<br/>&gt; On 04/11/2012 04:45 PM, Andy Lester wrote:<br/>&gt; &gt;test_requires is Module::Build only, right? I don&#39;t use<br/>&gt; &gt;Module::Build.<br/>&gt;<br/>&gt; No, I&#39;m pretty sure it works with Module::Install and<br/>&gt; ExtUtils::MakeMaker now too. Although that might just be something<br/>&gt; that was worked on at the qa-hackathon.<br/><br/>If the issue is really the extra download (for whatever reason that<br/>isn&rsquo;t obvious to me), Andy can also just copy it into t/lib. It&rsquo;s one<br/>dozen-line pure-perl file that isn&rsquo;t likely to ever change, so&hellip;<br/><br/>Might as well have it on CPAN instead of pasting a recipe into the<br/>Test::More docs and then having everyone paste that into their test<br/>scripts in turn.<br/><br/>&gt; &gt;Even if I did, I don&#39;t think I&#39;d require the user to go through<br/>&gt; &gt;a download and temporary build of AutoBailout.pm just to remove<br/>&gt; &gt;boilerplate.<br/>&gt;<br/>&gt; That&#39;s definitely a reasonable position to take.<br/><br/>Sure. Same can be said of many Test modules. Test::Exception or just<br/>make do with just an `eval` and some logic and a few extra tests?<br/>Test::Deep or just stick with the worse output of `is_deeply` when it<br/>suffices? Etc. Every author can make each of these choices whichever way<br/>they like, and so can Andy. Likewise with AutoBailout. The stop energy<br/>he is throwing at it has no substantive reason so far, only &ldquo;I don&rsquo;t<br/>care for this&rdquo;.<br/><br/>Regards,<br/>-- <br/>Aristotle Pagaltzis // &lt;http://plasmasturm.org/&gt;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13158.html Wed, 11 Apr 2012 15:48:14 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael Peters On 04/11/2012 04:45 PM, Andy Lester wrote:<br/><br/>&gt; test_requires is Module::Build only, right? I don&#39;t use Module::Build.<br/><br/>No, I&#39;m pretty sure it works with Module::Install and <br/>ExtUtils::MakeMaker now too. Although that might just be something that <br/>was worked on at the qa-hackathon.<br/><br/>&gt; Even if I did, I don&#39;t think I&#39;d require the user to go through a<br/>&gt; download and temporary build of AutoBailout.pm just to remove boilerplate.<br/><br/>That&#39;s definitely a reasonable position to take.<br/><br/>-- <br/>Michael Peters<br/>Plus Three, LP<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13157.html Wed, 11 Apr 2012 14:11:01 +0000 Re: Revert use_ok() change to allow lexical effects? by Andy Lester <br/>On Apr 11, 2012, at 3:38 PM, Michael Peters wrote:<br/><br/>&gt;&gt; As a module author, I would not require a user to install AutoBailout.pm just to remove boilerplate in my t/00-load.t<br/>&gt; <br/>&gt; With the test_requires stuff they won&#39;t have to. It will only be used for testing and not installed permanently on their system.<br/><br/><br/>test_requires is Module::Build only, right? I don&#39;t use Module::Build.<br/><br/>Even if I did, I don&#39;t think I&#39;d require the user to go through a download and temporary build of AutoBailout.pm just to remove boilerplate.<br/><br/>xoa<br/><br/>--<br/>Andy Lester =&gt; andy@petdance.com =&gt; www.petdance.com =&gt; AIM:petdance<br/><br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13156.html Wed, 11 Apr 2012 13:45:14 +0000 Re: Revert use_ok() change to allow lexical effects? by Aristotle Pagaltzis * Andy Lester &lt;andy@petdance.com&gt; [2012-04-11 22:30]:<br/>&gt; As a module author, I would not require a user to install<br/>&gt; AutoBailout.pm just to remove boilerplate in my t/00-load.t<br/><br/>If it&rsquo;s only a test_requires the user won&rsquo;t have to. (It would be pretty<br/>silly to keep discarding it though if it gets widespread use, esp seeing<br/>as it&rsquo;s only a dozen lines of pure Perl.)<br/><br/>&gt; But that&#39;s just me.<br/><br/>Yup. And it&rsquo;s a free country. :-)<br/><br/>Regards,<br/>-- <br/>Aristotle Pagaltzis // &lt;http://plasmasturm.org/&gt;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13155.html Wed, 11 Apr 2012 13:43:43 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael Peters On 04/11/2012 04:29 PM, Andy Lester wrote:<br/><br/>&gt; As a module author, I would not require a user to install AutoBailout.pm just to remove boilerplate in my t/00-load.t<br/><br/>With the test_requires stuff they won&#39;t have to. It will only be used <br/>for testing and not installed permanently on their system.<br/><br/>-- <br/>Michael Peters<br/>Plus Three, LP<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13154.html Wed, 11 Apr 2012 13:38:09 +0000 Re: Revert use_ok() change to allow lexical effects? by Andy Lester <br/>On Apr 11, 2012, at 3:01 PM, Aristotle Pagaltzis wrote:<br/><br/>&gt; OK. Then how about I stick AutoBailout on CPAN with a SYNOPSIS that<br/>&gt; covers `t/00-load.t`, and then you change the `use_ok` docs to a)<br/>&gt; discourage its use and b) point to AutoBailout for `t/00-load.t` uses.<br/>&gt; Sound good?<br/><br/><br/>As a module author, I would not require a user to install AutoBailout.pm just to remove boilerplate in my t/00-load.t<br/><br/>But that&#39;s just me.<br/><br/>xoa<br/><br/>--<br/>Andy Lester =&gt; andy@petdance.com =&gt; www.petdance.com =&gt; AIM:petdance<br/><br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13153.html Wed, 11 Apr 2012 13:29:36 +0000 Re: Revert use_ok() change to allow lexical effects? by Aristotle Pagaltzis Btw Ovid,<br/><br/>* Ovid &lt;publiustemp-perlqa3@yahoo.com&gt; [2012-04-11 19:10]:<br/>&gt; done_testing is applicable to every test module and solves the far<br/>&gt; more common issue of hating maintain a plan.<br/> ^^^^^^<br/><br/>a little Freudian slip there? :-)<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13152.html Wed, 11 Apr 2012 13:13:10 +0000 Re: Revert use_ok() change to allow lexical effects? by Aristotle Pagaltzis * Ovid &lt;publiustemp-perlqa3@yahoo.com&gt; [2012-04-11 21:55]:<br/>&gt; &gt;From: Michael G Schwern &lt;schwern@pobox.com&gt;<br/>&gt; &gt;Personally I&#39;m a fan of &quot;scroll up and read the first failure&quot;.&nbsp; It<br/>&gt; &gt;always works!<br/>&gt;<br/>&gt; Try it on a Test::Class test suite running thousands of test in<br/>&gt; a single process, whizzing past on your terminal :)&nbsp;<br/><br/>That is not relevant to t/00-load.t though, nor applicable when BAIL_OUT<br/>is involved, and here we are considering both of these.<br/><br/>Regards,<br/>-- <br/>Aristotle Pagaltzis // &lt;http://plasmasturm.org/&gt;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13151.html Wed, 11 Apr 2012 13:03:49 +0000 Re: Revert use_ok() change to allow lexical effects? by Aristotle Pagaltzis * Michael G Schwern &lt;schwern@pobox.com&gt; [2012-04-11 20:10]:<br/>&gt; On 2012.4.11 9:53 AM, Aristotle Pagaltzis wrote:<br/>&gt; &gt;I don&rsquo;t see how it is any more magic than `done_testing`.<br/>&gt;<br/>&gt; done_testing() has no global side effects, it&#39;s just a function.<br/>&gt;<br/>&gt; Unless I&#39;m mistaken, Test::AutoBailOut is doing to need a global<br/>&gt; $SIG{__DIE__} handler or override CORE::require or add something to<br/>&gt; @INC or try to parse exception messages or something like that. Any<br/>&gt; of those have global side effects which can potentially interfere with<br/>&gt; or be overwritten by the code being tested.<br/><br/>&hellip; what for? Is Ovid&rsquo;s solution of just using an END block insufficient?<br/>Why?<br/><br/>&gt; &gt; My suggestion to ship AutoBailOut was so you would be able to<br/>&gt; &gt; suggest it as a replacement in the docs, as it covers the one case<br/>&gt; &gt; where `use_ok` is even of interest (though still not the right<br/>&gt; &gt; solution).<br/>&gt; &gt;<br/>&gt; &gt; But I guess you could do that even if it ships outside of<br/>&gt; &gt; Test::More.<br/>&gt;<br/>&gt; Precisely. For example, it already suggests Test::Differences and<br/>&gt; Test::Deep.<br/><br/>OK. Then how about I stick AutoBailout on CPAN with a SYNOPSIS that<br/>covers `t/00-load.t`, and then you change the `use_ok` docs to a)<br/>discourage its use and b) point to AutoBailout for `t/00-load.t` uses.<br/>Sound good?<br/><br/>Regards,<br/>-- <br/>Aristotle Pagaltzis // &lt;http://plasmasturm.org/&gt;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13150.html Wed, 11 Apr 2012 13:01:38 +0000 Re: Revert use_ok() change to allow lexical effects? by Ovid ----- Original Message -----<br/><br/>&gt; From: Michael G Schwern &lt;schwern@pobox.com&gt;<br/><br/><br/>&gt;&gt; &nbsp; But it fails to DWIW: report clearly on failures.&nbsp; Perhaps what it is <br/>&gt; doing<br/>&gt;&gt; is not so simple, after all?<br/>&gt; <br/>&gt; Personally I&#39;m a fan of &quot;scroll up and read the first failure&quot;.&nbsp; <br/>&gt; It always works!<br/><br/><br/>Try it on a Test::Class test suite running thousands of test in a single process, whizzing past on your terminal :)&nbsp;<br/><br/>Cheers,<br/>Ovid<br/>--<br/>Live and work overseas - http://www.overseas-exile.com/<br/>Buy the book - http://www.oreilly.com/catalog/perlhks/<br/>Tech blog - http://blogs.perl.org/users/ovid/<br/>Twitter - http://twitter.com/OvidPerl/<br/><br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13149.html Wed, 11 Apr 2012 12:51:19 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael G Schwern On 2012.4.11 11:43 AM, Eirik Berg Hanssen wrote:<br/>&gt; If this fails, the test script will terminate immediately:<br/>&gt; <br/>&gt; * I won&#39;t get to know if any of the other modules loaded correctly, or how<br/>&gt; they fail. Less of the interesting output.<br/>&gt; * And there will be no BAIL_OUT, so the rest of the tests will run, burying<br/>&gt; the interesting output. More uninteresting output.<br/><br/>Like I said, if use_ok() is working for you keep using it. Your example where<br/>you want to load a bunch of modules just to make sure they compile is one of<br/>those cases where use_ok() is probably the right thing.<br/><br/><br/>&gt; &gt; * Why would you? :-\<br/>&gt; <br/>&gt; Because it reads like normal Perl and doesn&#39;t rely on more code to do<br/>&gt; something rather simple: load a module.<br/>&gt; <br/>&gt; But it fails to DWIW: report clearly on failures. Perhaps what it is doing<br/>&gt; is not so simple, after all?<br/><br/>Personally I&#39;m a fan of &quot;scroll up and read the first failure&quot;. It always works!<br/><br/><br/>-- <br/>7. Not allowed to add &quot;In accordance with the prophesy&quot; to the end of<br/> answers I give to a question an officer asks me.<br/> -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army<br/> http://skippyslist.com/list/<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13148.html Wed, 11 Apr 2012 12:27:18 +0000 Re: 00-load.t tool by Eric Wilhelm # from Michael G Schwern<br/># on Wednesday 11 April 2012 11:06:<br/><br/>&gt;&gt; What exactly makes you uneasy? Maybe there is a way to address that<br/>&gt;&gt; if you can be more specific.<br/>&gt;<br/>&gt;Mostly that it&#39;s cramming yet more complexity into core test library<br/>&gt; for a fairly narrow use case and functionality that lives quite<br/>&gt; happily in its own module. &Acirc;&nbsp;It&#39;s already difficult enough to keep<br/>&gt; stable.<br/>&gt;<br/>&gt;To reverse it, why should it be in Test::More? &Acirc;&nbsp;&quot;People don&#39;t like to<br/>&gt; have extra test dependencies&quot; is not accepted.<br/><br/>Looking at this a different way, instead of a library, make a distzilla <br/>extension (or whatever) which generates (and regenerates) a 00-load.t <br/>as per Ovid&#39;s earlier example.<br/><br/>The trouble with having it in a library is not just that you have a test <br/>dependency, but also that you have to add more complexity to the <br/>library (and then you have a test dependency on a newer version) <br/>whenever someone wants to do a complex thing.<br/><br/>Many modules in a distribution may not load unless $optional_dependency <br/>is satisfied. But, it is good to precheck all of the modules in a <br/>distribution before starting tests (aside: did someone say prefork?) <br/>and helps to wrap this in some useful diagnostic + bail out.<br/><br/>I think something which embeds code in a 00-load.t, plus helps you <br/>maintain a list of modules by scanning lib/ would be a handy way to do <br/>that. (Perhaps a list + hash to address the optional dependencies and <br/>each optional module has a subref to determine if it is enabled.)<br/><br/>One could argue that the functionality should be included in each test <br/>file to keep things orthogonal. Such a one may find that there may be <br/>a way to require(&quot;./t/00-load.t&quot;) from each test file, but might also <br/>end up with a library and/or a hybrid with regenerative breaking <br/>(prefork.)<br/><br/>--Eric<br/>-- <br/>But you can never get 3n from n, ever, and if you think you can, please<br/>email me the stock ticker of your company so I can short it.<br/>--Joel Spolsky<br/>---------------------------------------------------<br/> http://scratchcomputing.com<br/>---------------------------------------------------<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13147.html Wed, 11 Apr 2012 11:27:05 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael G Schwern On 2012.4.11 9:53 AM, Aristotle Pagaltzis wrote:<br/>&gt; * Michael G Schwern &lt;schwern@pobox.com&gt; [2012-04-11 18:35]:<br/>&gt;&gt; Nope, too much magic for too small a use case.<br/>&gt; <br/>&gt; And faithfully duplicating `use` would be less so? :-)<br/><br/>This discussion is about backing away from that. The most magical bits of<br/>use_ok() have not yet gone out in a stable and can be reverted.<br/><br/><br/>&gt; I don&rsquo;t see how it is any more magic than `done_testing`.<br/><br/>done_testing() has no global side effects, it&#39;s just a function.<br/><br/>Unless I&#39;m mistaken, Test::AutoBailOut is doing to need a global $SIG{__DIE__}<br/>handler or override CORE::require or add something to @INC or try to parse<br/>exception messages or something like that. Any of those have global side<br/>effects which can potentially interfere with or be overwritten by the code<br/>being tested.<br/><br/><br/>&gt; What exactly makes you uneasy? Maybe there is a way to address that<br/>&gt; if you can be more specific.<br/><br/>Mostly that it&#39;s cramming yet more complexity into core test library for a<br/>fairly narrow use case and functionality that lives quite happily in its own<br/>module. It&#39;s already difficult enough to keep stable.<br/><br/>To reverse it, why should it be in Test::More? &quot;People don&#39;t like to have<br/>extra test dependencies&quot; is not accepted. If you want to bundle it all<br/>together into a sort of universal set of testing extensions, Test::Most does that.<br/><br/>While it could be argued that every distribution should be testing that their<br/>modules load and bailing out if they don&#39;t, the bailing out part we can live<br/>without. But it is handy.<br/><br/><br/>&gt;&gt; It works fine if what you want is a runtime require + import + assert,<br/>&gt;&gt; and sometimes you want that. The problem is it&#39;s been overused and<br/>&gt;&gt; has come to replace a simple `use` in test scripts. To that end the<br/>&gt;&gt; question is whether to *discourage* its use in the documentation: to<br/>&gt;&gt; scale it back from &quot;use this when you load a module&quot; to &quot;use this for<br/>&gt;&gt; some special cases&quot;.<br/>&gt; <br/>&gt; *Which* special cases? I would rather not recommend it in any case ever.<br/><br/>In my reply to Andy I outlined some cases where you need a runtime require +<br/>import + assert and its better to have a function which does that than write<br/>it all out by hand.<br/><br/><br/>&gt; My suggestion to ship AutoBailOut was so you would be able to suggest it<br/>&gt; as a replacement in the docs, as it covers the one case where `use_ok`<br/>&gt; is even of interest (though still not the right solution).<br/>&gt; <br/>&gt; But I guess you could do that even if it ships outside of Test::More.<br/><br/>Precisely. For example, it already suggests Test::Differences and Test::Deep.<br/><br/><br/>-- <br/>185. My name is not a killing word.<br/> -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army<br/> http://skippyslist.com/list/<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13146.html Wed, 11 Apr 2012 11:06:13 +0000 Re: Revert use_ok() change to allow lexical effects? by Aristotle Pagaltzis * Smylers &lt;Smylers@stripey.com&gt; [2012-04-11 18:20]:<br/>&gt; Aristotle Pagaltzis writes:<br/>&gt; &gt; my $reason = &#39;Tests must succeeded&#39;;<br/>&gt;<br/>&gt; Grammar correction if anybody is going to publish this in a module:<br/>&gt; &quot;succeed&quot;, rather than &quot;succeeded&quot;.<br/><br/>Woops. Thanks.<br/><br/>&gt; &gt; Ah d&rsquo;uh! Now I feel stupid.<br/>&gt;<br/>&gt; Please don&#39;t! You&#39;re still ahead many of us ...<br/><br/>See above. ;-)<br/><br/>Regards,<br/>-- <br/>Aristotle Pagaltzis // &lt;http://plasmasturm.org/&gt;<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13145.html Wed, 11 Apr 2012 10:49:06 +0000 Re: Revert use_ok() change to allow lexical effects? by Michael G Schwern On 2012.4.11 9:39 AM, Andy Lester wrote:<br/>&gt; In this example:<br/>&gt; <br/>&gt; BEGIN {<br/>&gt; use_ok( &#39;App::Ack&#39; );<br/>&gt; use_ok( &#39;App::Ack::Repository&#39; );<br/>&gt; use_ok( &#39;App::Ack::Resource&#39; );<br/>&gt; use_ok( &#39;File::Next&#39; );<br/>&gt; }<br/>&gt; diag( &quot;Testing App::Ack $App::Ack::VERSION, File::Next $File::Next::VERSION, Perl $], $^X&quot; );<br/>&gt; <br/>&gt; it sounds like we&#39;re saying that the use_ok() doesn&#39;t help at all, and I might as well write<br/>&gt; <br/>&gt; use App::Ack;<br/>&gt; use App::Ack::Repository;<br/>&gt; use App::Ack::Resource;<br/>&gt; use File::Next;<br/>&gt; diag( &quot;Testing App::Ack $App::Ack::VERSION, File::Next $File::Next::VERSION, Perl $], $^X&quot; );<br/>&gt; <br/>&gt; Agreed?<br/><br/>Yes, exactly.<br/><br/><br/>-- <br/>I do have a cause though. It&#39;s obscenity. I&#39;m for it.<br/> - Tom Lehrer<br/> http://www.nntp.perl.org/group/perl.qa/2012/04/msg13144.html Wed, 11 Apr 2012 10:43:26 +0000