Dist::Zilla Likes Toys

Yeah another test play-date here in the Dist-Pen.

Playing with testing and Dist::Zilla over the last few posts has not only introduced me to a the newer 'Perlish' way to ogranize your test cases but I have seen a good number of plug-ins that might be interesting for me to add into my '.ini' file. Now besides the two I really wanted and have added in '[Test::Kwalitee]' and '[Test::Perl::Critic]' I know very little about the others so I am just going to plow though them alphabetically.

So my first batch of test plug-ins for today are

CheckBreaks
Well after a quick read this is not now for me at this stage as it provides a '/t' or 'Module' level test case that is set up to inform anyone trying to install the distribution that something will break if you do. Right now and most likely in the future I do not see Database::Accessor being used within something else so I can give this on a miss.

CheckChanges
This one provides a 'Release' test case that ensures that you have an entry in a 'Changes' file before you can release. As I already have [CheckChangeLog] plug-in install I would only be doing the same test twice so this one is out.

CheckDeps
Another plug-in that puts a 'Module' level test case in your distribution that will do a quick dependency test when installing. Now I already have the [AutoPrereqs] which should fix up my Make and Build '.PL' with the correct info to fail so I think I will give this one a miss as well.

CheckManifest
Another 'Release' test plug-in this time adding in a test to ensure that what is in the Manifest is in your distro and it does this my using 'Test::CheckManifest' under the hood. Again I have a plug-in that does that [Manifest] so why do things twice so this one is out

CleanNamespaces
Now here is one that I can use. It is an 'Author' test case that checks to see if I have any 'imported functions' that have not been removed. In the Moose world this is almost standard protace to clean out all the Moose-poop functions that are only useful at start up. So lets add this one into my '.ini' after I install it of course;


[Test::Perl::Critic]
critic_config = perlcritic.rc
++[Test::CleanNamespaces]
[Git::Check] 
and run with 'dzil xtest author' I get

xt/author/clean-namespaces.t .. Useless use of string in void context at /home/scolesj/database-accessor/.build/gnmxivC9Vg/blib/lib/Database/Accessor.pm line 109.

# Failed test 'Database::Accessor contains no imported functions'
# at /usr/local/share/perl/5.18.2/Test/CleanNamespaces.pm line 79.
# remaining imports: {
# 'after' => 'Moose::after',
# 'around' => 'Moose::around',
# 'augment' => 'Moose::augment',


No need to show the other sixty lines of output as I can see that all the Moose-poop that was left in as I have yet to add in namespace::autoclean or namespace::clean into my Accessor.pm. So this one is a keeper.

Dist::Zilla::Plugin::Test::Compile
Another 'Module' level test is provided by this plug-in and it will try and compile all the appropriate files in your Distro using only Core Perl. A great test if you are doing low level or universal modulus but not much use to me as Accessor.pm has strayed far off the Core path and finally;

Dist::Zilla::Plugin::Test::Compile::PerlFile
This is the evil twin of Test::Compile a much more extensive test case with all sorts of configurable bells and whistles, again not one I am going to use in this distribution.

Well it is only one hit for today 'CleanNamespaces' but at lest I can see another path you can take when using Dist::Zilla. The path I have chosen to do a number of things automajikaly and or if you do not like or cannot use the automajik route you can cover yourself by installing Test plug-in that will do the same job.

godzilla-toy-27998.jpg

4 Comments

Dist::Zilla::Plugin::Test::Compile has nothing to do with "core" perl. How did you get that idea?

The test itself only uses core modules. (The comma is important!) Therefore it adds no extra dependencies to your distribution.

It doesn't matter what dependencies your own module has.

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations