On 6 August 2015 at 09:24, Alex Becker <asb.c...@gmail.com> wrote: > I started to use Test::POD and Test__POD::Coverage in my modules. > However, I got the feedback that these tests should not be done when someone > installs the module from CPAN. The logic is quite clear: POD issues are not > critical. > > So, there will be author tests. I saw a few other modules that introduced > environment variables to indicate that these author tests should be run. > During make test, the corresponding tests are skipped with a proper message. > > But, what's the best way to define when author tests should be run? > I don't like the idea to have some arbitrary environment variable name. > > Module::Starter introduces RELEASE_TESTING. Is this the standard way? > > I know, Perl is TIMTOWTDI and bla bla bla. But I don't want to reinvent the > wheel. I want to create modules that are reliable and just work(TM) for > others. > > Best regards, > Alex
The "Best" option in my option is a workflow that puts the author/release tests etc in xt/* , and then conditionally loads them under AUTHOR_TESTING or RELEASE_TESTING, such as what these extensions do: - https://metacpan.org/pod/Module::Install::AuthorTests - https://metacpan.org/release/Dist-Zilla-Plugin-CheckExtraTests This is nice, because it means if you *ship* those tests, whoever is doing the installation side testing doesn't need to wade through a dozen lines of "SKIPPED: This test is for AUTHOR_TESTING" etc when they get a failing test. Its also easy enough to make mistakes in how you turn on/off author testing that can, in themselves, create bugs of their own. ( This is rare, but I've seen it ) These specific variables are documented by the Oslo Consensus docs: http://cpan.io/ref/toolchain/lancaster-consensus.html And if you choose to have author/release tests in t/, then the recommended code block is similar to the guard block a Dist::Zilla plugin adds: Author tests: BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } Release tests: BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } And for tests that will run on smoke boxes: BEGIN { unless ($ENV{AUTOMATED_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for "smoke bot" testing'); } } -- Kent KENTNL - https://metacpan.org/author/KENTNL -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/