gnustavo / Git-Hooks

Framework for implementing Git (and Gerrit) hooks
http://search.cpan.org/dist/Git-Hooks/
41 stars 17 forks source link

use Test::Requires to skip tests #1

Closed xenoterracide closed 11 years ago

xenoterracide commented 11 years ago

had some problems with tests not skipping that should. The best way to handle this is to use Test::Requires. here's a patch that adds it.

As a side note I notice that you're using dzil (according to your metadata) but the branch that has your dist.ini isn't in your repo.

Signed-off-by: Caleb Cushing xenoterracide@gmail.com

gnustavo commented 11 years ago

Hi Caleb.

The t/02-check-jira.t test don't need to load JIRA::Client because it uses a fake module. Take a look at the setup_repos_for routine. This way I don't need to interact with a real JIRA server to test.

Regarding the Text::SpellChecker module, I'm afraid simply requiring it isn't enough. It depends on either Text::Hunspell or Text::Aspell, but it doesn't check for them until the first time I call its next_word method. It's possible to use it and even to create a Text::SpellChecker object before realizing that those two dependencies are absent. That's why I invoke the Git::Hooks::CheckLog::_spell_checker routine in t/02-check-log.t. This routine checks if it can succesfully invoke Text::SpellChecker::next_word.

But you said some tests were being skipped. Can you tell me a little more about it?

Ah, the dist.ini file in on the master branch. How could you have missed it?

Thank you for your interest.

Gustavo

xenoterracide commented 11 years ago

I have no idea how I missed it... my brain doing a thing... apparently unhandled exception

perhaps I also typoed my message. it's not that tests were being skipped it's that they weren't.

note: also currently this module is required by the dist (because it's not being skipped)

not ok 20 - deny misspelling with checking

Failed test 'deny misspelling with checking'

at t/test-functions.pl line 217.

did not match regex ((?^:log has the following spelling problems in it))

exit=

stdout=CheckLog: Could not require Text::SpellChecker module to spell messages.

Can't locate Text/SpellChecker.pm in @INC (@INC contains: /home/ccushing/Git-Hooks/lib /home/ccushing/bluehost/lib/perl5/x86_64-linux /home/ccushing/bluehost/lib/perl5 blib/lib /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/x86_64-linux /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2 /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/x86_64-linux /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2 .) at /home/ccushing/Git-Hooks/lib/Git/Hooks/CheckLog.pm line 79.

git-version=git version 1.7.10.4

Looks like you failed 1 test of 20.

basically Text::Aspell fails to install and I can't be arsed to find out why. So I spent 1 minute on a quick hack.

gnustavo commented 11 years ago

Ah. you're right. The way I was trying to skip the spelling tests on t/02-check-log.t was completely wrong.

Also, I had forgotten to make Text::SpellChecker a simple recommendation. It was really being required.

I just released v0.029 which hopefuly fixes these two problems. It should appear shortly on CPAN.

Thank you very much!

2012/12/26 Caleb Cushing notifications@github.com

I have no idea how I missed it... my brain doing a thing... apparently unhandled exception

perhaps I also typoed my message. it's not that tests were being skipped it's that they weren't.

note: also currently this module is required by the dist (because it's not being skipped)

not ok 20 - deny misspelling with checking Failed test 'deny misspelling with checking' at t/test-functions.pl line

  1. did not match regex ((?^:log has the following spelling problems in it)) exit= stdout=CheckLog: Could not require Text::SpellChecker module to spell messages. Can't locate Text/SpellChecker.pm in @INChttps://github.com/INC( @INC https://github.com/INC contains: /home/ccushing/Git-Hooks/lib /home/ccushing/bluehost/lib/perl5/x86_64-linux /home/ccushing/bluehost/lib/perl5 blib/lib /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/x86_64-linux /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2 /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/x86_64-linux /home/ccushing/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2 .) at /home/ccushing/Git-Hooks/lib/Git/Hooks/CheckLog.pm line 79. git-version=git version 1.7.10.4 Looks like you failed 1 test of 20.

basically Text::Aspell fails to install and I can't be arsed to find out why. So I spent 1 minute on a quick hack.

— Reply to this email directly or view it on GitHubhttps://github.com/gnustavo/Git-Hooks/pull/1#issuecomment-11697761.

Gustavo.

gnustavo commented 11 years ago

I'm closing this issue. I guess it's fixed for good by the results I see on http://cpantesters.org/distro/G/Git-Hooks.html